Log when a module is unloaded, including how many references are left to the
module object
This commit is contained in:
parent
2206502cca
commit
164f0b0bbf
1 changed files with 6 additions and 0 deletions
|
@ -91,4 +91,10 @@ class ModuleManager(object):
|
|||
self.events.purge_context(event_context)
|
||||
|
||||
del sys.modules[name]
|
||||
references = sys.getrefcount(module)
|
||||
del module
|
||||
references -= 1 # 'del module' removes one reference
|
||||
references -= 1 # one of the refs is from getrefcount
|
||||
|
||||
self.bot.log.info("Module '%s' unloaded (%d reference%s)",
|
||||
[name, references, "" if references == 1 else "s"])
|
||||
|
|
Loading…
Reference in a new issue