summaryrefslogtreecommitdiff
path: root/pluginbase.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2014-07-01 00:31:23 +0200
committerArmin Ronacher <armin.ronacher@active-4.com>2014-07-01 00:31:23 +0200
commit73c752a9d643c06979a4f64ace35a2568e81ec4c (patch)
tree25287667668a4e4579155021199e53722455b319 /pluginbase.py
parent1e6456bf54bb37743d22fe564b475f10bc13281e (diff)
downloadpluginbase-73c752a9d643c06979a4f64ace35a2568e81ec4c.tar.gz
Fixed shutdown error on late garbage collection.
Diffstat (limited to 'pluginbase.py')
-rw-r--r--pluginbase.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/pluginbase.py b/pluginbase.py
index 9f11abf..426a105 100644
--- a/pluginbase.py
+++ b/pluginbase.py
@@ -265,16 +265,17 @@ class PluginSource(object):
return __import__(self.base.package + '.' + name,
globals(), {}, ['__name__'])
- def cleanup(self, _sys=sys):
+ def cleanup(self):
"""Cleans up all loaded plugins manually. This is necessary to
call only if :attr:`persist` is enabled. Otherwise this happens
automatically when the source gets garbage collected.
-
- :param _sys: the sys module to use for cleaning up. This parameter
- seems useless a the default is always the right one
- anyways but it supports the shutdown when the
- interpreter terminates.
"""
+ self.__cleanup()
+
+ def __cleanup(self, _sys=sys, _shutdown_module=_shutdown_module):
+ # The default parameters are necessary because this can be fired
+ # from the destructor and so late when the interpreter shuts down
+ # that these functions and modules might be gone.
if self.mod is None:
return
modname = self.mod.__name__