summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer McIntyre <zeroSteiner@gmail.com>2016-06-16 21:17:15 -0400
committerSpencer McIntyre <zeroSteiner@gmail.com>2016-06-16 21:17:15 -0400
commit17aeaef965fb7201ed12acb548fad50061f7dae1 (patch)
treed489c7b295568194aec34d998a34634be84ee848
parent9e5764f1316ffc8819dd221153d87158a33ec895 (diff)
parente6c1df55f7cbe8c861be5e2ae262ad98e6090fd1 (diff)
downloadpluginbase-17aeaef965fb7201ed12acb548fad50061f7dae1.tar.gz
Land #11, Check the entry exists in _sys.modules
Ensure that the entry to be removed exists in _sys.modules before trying to remove it as part of PluginSource.__cleanup. Fixes #6
-rw-r--r--pluginbase.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pluginbase.py b/pluginbase.py
index 16a707c..e4a48d6 100644
--- a/pluginbase.py
+++ b/pluginbase.py
@@ -317,7 +317,9 @@ class PluginSource(object):
except AttributeError:
pass
prefix = modname + '.'
- _sys.modules.pop(modname)
+ # avoid the bug described in issue #6
+ if modname in _sys.modules:
+ del _sys.modules[modname]
for key, value in list(_sys.modules.items()):
if not key.startswith(prefix):
continue