From 69b7cb1a78059f7c06078c7bb971dc2cfde7503e Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 24 Mar 2012 23:54:22 -0400 Subject: [PATCH] Keep dynamic module in an attr so it doesn't get dealloc'd --- earwigbot/irc/watcher.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/earwigbot/irc/watcher.py b/earwigbot/irc/watcher.py index bfe1b8a..f3731a7 100644 --- a/earwigbot/irc/watcher.py +++ b/earwigbot/irc/watcher.py @@ -81,19 +81,20 @@ class Watcher(IRCConnection): This will get put in the function self._process_hook, which takes an RC object and returns a list of frontend channels to report this event to. """ - # Default RC process hook does nothing: + # Set a default RC process hook that does nothing: self._process_hook = lambda rc: () try: rules = config.data["rules"] except KeyError: return - module = imp.new_module("_rc_event_rules") + module = imp.new_module("_rc_event_processing_rules") try: exec compile(rules, config.config_path, "exec") in module.__dict__ except Exception: e = "Could not compile config file's RC event rules" self.logger.exception(e) return + self._process_hook_module = module try: self._process_hook = module.process except AttributeError: