Also unload submodules within packages (ModuleManager.py)
This commit is contained in:
parent
dec3485071
commit
8a0fd009e4
1 changed files with 6 additions and 0 deletions
|
@ -203,7 +203,13 @@ class ModuleManager(object):
|
||||||
|
|
||||||
module = loaded_module.module
|
module = loaded_module.module
|
||||||
del loaded_module.module
|
del loaded_module.module
|
||||||
|
|
||||||
del sys.modules[loaded_module.import_name]
|
del sys.modules[loaded_module.import_name]
|
||||||
|
namespace = "%s." % loaded_module.import_name
|
||||||
|
for import_name in list(sys.modules.keys()):
|
||||||
|
if import_name.startswith(namespace):
|
||||||
|
del sys.modules[import_name]
|
||||||
|
|
||||||
references = sys.getrefcount(module)
|
references = sys.getrefcount(module)
|
||||||
referrers = gc.get_referrers(module)
|
referrers = gc.get_referrers(module)
|
||||||
del module
|
del module
|
||||||
|
|
Loading…
Reference in a new issue