Show More
@@ -39,6 +39,7 b' import sys' | |||
|
39 | 39 | |
|
40 | 40 | from types import ModuleType |
|
41 | 41 | from warnings import warn |
|
42 | import types | |
|
42 | 43 | |
|
43 | 44 | original_import = builtin_mod.__import__ |
|
44 | 45 | |
@@ -162,6 +163,7 b' def load_next(mod, altmod, name, buf):' | |||
|
162 | 163 | |
|
163 | 164 | return result, next, buf |
|
164 | 165 | |
|
166 | ||
|
165 | 167 | # Need to keep track of what we've already reloaded to prevent cyclic evil |
|
166 | 168 | found_now = {} |
|
167 | 169 | |
@@ -269,6 +271,12 b' modules_reloading = {}' | |||
|
269 | 271 | |
|
270 | 272 | def deep_reload_hook(m): |
|
271 | 273 | """Replacement for reload().""" |
|
274 | # Hardcode this one as it would raise a NotImplemeentedError from the | |
|
275 | # bowels of Python and screw up the import machinery after. | |
|
276 | # unlike other imports the `exclude` list aleady in place is not enough. | |
|
277 | ||
|
278 | if m is types: | |
|
279 | return m | |
|
272 | 280 | if not isinstance(m, ModuleType): |
|
273 | 281 | raise TypeError("reload() argument must be module") |
|
274 | 282 | |
@@ -319,7 +327,7 b' def deep_reload_hook(m):' | |||
|
319 | 327 | return newm |
|
320 | 328 | |
|
321 | 329 | # Save the original hooks |
|
322 |
original_reload = imp.reload |
|
|
330 | original_reload = imp.reload | |
|
323 | 331 | |
|
324 | 332 | # Replacement for reload() |
|
325 | 333 | def reload(module, exclude=('sys', 'os.path', 'builtins', '__main__', |
General Comments 0
You need to be logged in to leave comments.
Login now