Author amaury.forgeotdarc
Recipients akl, amaury.forgeotdarc
Date 2011-09-25.21:48:46
SpamBayes Score 3.03451e-07
Marked as misclassified No
Message-id <1316987328.71.0.931782052838.issue13044@psf.upfronthosting.co.za>
In-reply-to
Content
By modifying a bit the Python intepreter, I got this traceback:

Traceback (most recent call last):
  File "/home/amauryfa/python/cpython2.7/Lib/_weakrefset.py", line 38, in _remove
    def _remove(item, selfref=ref(self)):
  File "/home/amauryfa/python/cpython2.7/Lib/bdb.py", line 50, in trace_dispatch
    return self.dispatch_call(frame, arg)
  File "/home/amauryfa/python/cpython2.7/Lib/bdb.py", line 76, in dispatch_call
    if not (self.stop_here(frame) or self.break_anywhere(frame)):
  File "/home/amauryfa/python/cpython2.7/Lib/bdb.py", line 147, in break_anywhere
    return self.canonic(frame.f_code.co_filename) in self.breaks
  File "/home/amauryfa/python/cpython2.7/Lib/bdb.py", line 33, in canonic
    canonic = os.path.abspath(filename)
AttributeError: 'NoneType' object has no attribute 'path'

Here is the gdb stack when the error is printed:

#0  PyErr_Print () at Python/pythonrun.c:1040
#1  0x0000000000480c1d in handle_callback (object=<value optimized out>) at Objects/weakrefobject.c:884
#2  PyObject_ClearWeakRefs (object=<value optimized out>) at Objects/weakrefobject.c:966
#3  0x0000000000423a37 in class_dealloc (op=0x7ffff7f68890) at Objects/classobject.c:193
#4  0x000000000046a7ed in tupledealloc (op=0x7ffff7f89410) at Objects/tupleobject.c:220
#5  0x0000000000423afb in class_dealloc (op=0x7ffff7f7ed50) at Objects/classobject.c:194
#6  0x00000000004270cb in instance_dealloc (inst=0x7ffff7f8a518) at Objects/classobject.c:670
#7  0x000000000044de47 in insertdict (mp=0x7f7800, key='environ', hash=-5347984860299468300, value=None)
    at Objects/dictobject.c:530
#8  0x0000000000450287 in PyDict_SetItem (op=
    {'WTERMSIG': None, 'lseek': None, 'EX_IOERR': None, 'EX_NOHOST': None, 'seteuid': None, 'pathsep': None, 'execle': None, 'major': None, '_Environ': None, 'fstatvfs': None, 'uname': None, 'kill': None, 'urandom': None, 'execlp': None, 'getegid': None, 'getresgid': None, 'EX_OSFILE': None, 'umask': None, 'linesep': None, 'fchmod': None, 'lchown': None, 'setgid': None, 'tmpnam': None, 'devnull': None, 'EX_NOINPUT': None, 'makedev': None, 'fstat': None, 'getlogin': None, 'O_CREAT': None, 'dup2': None, 'read': None, '__file__': None, 'getppid': None, 'fchown': None, 'getloadavg': None, 'WIFSTOPPED': None, 'getpgrp': None, '_spawnvef': None, 'TMP_MAX': None, 'utime': None, 'execl': None, 'F_OK': None, '_make_stat_result': None, 'name': None, 'fsync': None, 'tcsetpgrp': None, 'statvfs': None, 'setreuid': None, 'remove': None, 'setegid': None, 'P_NOWAITO': None, '_copy_reg': None, 'execv': None, 'spawnv': None, 'spawnvpe': None, 'EX_OSERR': None, 'ttyname': None, 'pardir': None, 'tempnam': None, 'tmpfile': None, 'sep...(truncated), key='environ', value=None) at Objects/dictobject.c:775
#9  0x000000000045268e in _PyModule_Clear (m=<value optimized out>) at Objects/moduleobject.c:138
#10 0x00000000004bfa17 in PyImport_Cleanup () at Python/import.c:498
#11 0x00000000004cd9ef in Py_Finalize () at Python/pythonrun.c:447

So, when the interpreter shuts down, the debugger is still active...
Python 3 does not seem to be affected by this issue. And indeed if I make UserDict a new-style class, I don't reproduce the error on 2.7 either.

A possible fix is to reset the trace function to None in Py_Finalize.
History
Date User Action Args
2011-09-25 21:48:48amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, akl
2011-09-25 21:48:48amaury.forgeotdarcsetmessageid: <1316987328.71.0.931782052838.issue13044@psf.upfronthosting.co.za>
2011-09-25 21:48:48amaury.forgeotdarclinkissue13044 messages
2011-09-25 21:48:46amaury.forgeotdarccreate