##// END OF EJS Templates
deepreload: Use `sys.builtin_module_names` to exclude builtins
Nikita Kniazev -
Show More
@@ -282,11 +282,22 b' def deep_reload_hook(m):'
282 282 original_reload = importlib.reload
283 283
284 284 # Replacement for reload()
285 def reload(module, exclude=('sys', 'os.path', 'builtins', '__main__',
286 'numpy', 'numpy._globals')):
285 def reload(
286 module,
287 exclude=(
288 *sys.builtin_module_names,
289 "sys",
290 "os.path",
291 "builtins",
292 "__main__",
293 "numpy",
294 "numpy._globals",
295 ),
296 ):
287 297 """Recursively reload all modules used in the given module. Optionally
288 298 takes a list of modules to exclude from reloading. The default exclude
289 list contains sys, __main__, and __builtin__, to prevent, e.g., resetting
299 list contains modules listed in sys.builtin_module_names with additional
300 sys, os.path, builtins and __main__, to prevent, e.g., resetting
290 301 display, exception, and io hooks.
291 302 """
292 303 global found_now
General Comments 0
You need to be logged in to leave comments. Login now