From e342889937b460b39e6ccdf2df7d4128c341a523 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 23 Jul 2016 21:59:25 -0700 Subject: [PATCH] corecommands: really fix 'reload' (cherry picked from commit 150bfe8c663387f58d4fff820ead19a215191cae) --- coremods/corecommands.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/coremods/corecommands.py b/coremods/corecommands.py index b372a9b..b2265f5 100644 --- a/coremods/corecommands.py +++ b/coremods/corecommands.py @@ -72,7 +72,7 @@ def load(irc, source, args): return log.info('(%s) Loading plugin %r for %s', irc.name, name, irc.getHostmask(source)) try: - world.plugins[name] = pl = importlib.reload(utils.loadPlugin(name)) + world.plugins[name] = pl = utils.loadPlugin(name) except ImportError as e: if str(e) == ('No module named %r' % name): log.exception('Failed to load plugin %r: The plugin could not be found.', name) @@ -139,10 +139,11 @@ def unload(irc, source, args): # Delete it from memory (hopefully). del world.plugins[name] - if name in sys.modules: - del sys.modules[name] - if name in globals(): - del globals()[name] + for n in (name, modulename): + if n in sys.modules: + del sys.modules[n] + if n in globals(): + del globals()[n] # Garbage collect. gc.collect()