From 84f64e5856817cf8923d0b02f20febda3ce646a0 2018-09-29 17:00:51 From: Emil Hessman Date: 2018-09-29 17:00:51 Subject: [PATCH] Avoid modifying mutable default value --- diff --git a/IPython/extensions/autoreload.py b/IPython/extensions/autoreload.py index 306bb8b..ca6be10 100644 --- a/IPython/extensions/autoreload.py +++ b/IPython/extensions/autoreload.py @@ -338,7 +338,7 @@ class StrongRef(object): return self.obj -def superreload(module, reload=reload, old_objects={}): +def superreload(module, reload=reload, old_objects=None): """Enhanced version of the builtin reload function. superreload remembers objects previously in the module, and @@ -348,6 +348,8 @@ def superreload(module, reload=reload, old_objects={}): - clears the module's namespace before reloading """ + if old_objects is None: + old_objects = {} # collect old objects in the module for name, obj in list(module.__dict__.items()):