From 2535aa145febe50f46ab4fcb31e384d59e9fd679 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 23 Sep 2017 13:39:13 -0700 Subject: [PATCH] corecommands: fix unloading plugins that define hooks This fixes a regression from 5e92aefcd49a7a4944d9b6c308cc7ae482a216b6. --- coremods/corecommands.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coremods/corecommands.py b/coremods/corecommands.py index 3f4ea6c..6be0f9e 100644 --- a/coremods/corecommands.py +++ b/coremods/corecommands.py @@ -161,9 +161,10 @@ def unload(irc, source, args): for hookpair in hookpairs: hookfunc = hookpair[1] if hookfunc.__module__ == modulename: - world.hooks[hookname].remove(hookfunc) + log.debug('Trying to remove hook func %s (%s) from plugin %s', hookfunc, hookname, modulename) + world.hooks[hookname].remove(hookpair) # If the hookfuncs list is empty, remove it. - if not hookfuncs: + if not hookpairs: del world.hooks[hookname] # Call the die() function in the plugin, if present.