[Python-Dev] Is this a bug? (original) (raw)

Matt Fleming mattjfleming at googlemail.com
Wed Aug 9 17:19:33 CEST 2006


On 09/08/06, Georg Brandl <g.brandl at gmx.net> wrote:

Is this considered a bug? Sure, deleting modules from sys.modules isn't quite common, but it happened to me on one occasion.

Python 2.4.3 (#1, Jul 29 2006, 10:52:20) >>> import logging >>> import sys >>> del logging >>> del sys.modules['logging'] >>> ^D Error in atexit.runexitfuncs: Traceback (most recent call last): File "/usr/lib/python2.4/atexit.py", line 24, in runexitfuncs func(*targs, **kargs) File "/usr/lib/python2.4/logging/init.py", line 1328, in shutdown for h in handlerList[:]: # was handlers.keys(): TypeError: unsubscriptable object Error in sys.exitfunc: Traceback (most recent call last): File "/usr/lib/python2.4/atexit.py", line 24, in runexitfuncs func(*targs, **kargs) File "/usr/lib/python2.4/logging/init.py", line 1328, in shutdown for h in handlerList[:]: # was handlers.keys(): TypeError: unsubscriptable object Obviously, handlerList (as a global) is already cleaned up, which is why the subscript fails. Georg


Could it be considered a bug in the atexit module (or is that what you meant)? Seeing as there's no decent way to recover from this error, perhaps it could just slip silently passed?

-- Matt

http://mattssanctuary.blogspot.com



More information about the Python-Dev mailing list