[New-bugs-announce] [issue17922] Crash in clear_weakref

Jan Safranek report at bugs.python.org
Tue May 7 09:38:00 CEST 2013

New submission from Jan Safranek:

I have Python 2.7.4 running on Fedora Rawhide and I get segmentation fault with following backtrace:

#0  0x00007f73f69ca5f1 in clear_weakref (self=0x7f73ff515c00) at Objects/weakrefobject.c:56
#1  weakref_dealloc (self=0x7f73ff515c00) at Objects/weakrefobject.c:106
#2  0x00007f73f698ea27 in PyList_SetItem (op=<optimized out>, i=<optimized out>, newitem=<optimized out>) at Objects/listobject.c:218
#3  0x00007f73f69ba9db in add_subclass (type=type at entry=0x7f73e00456b0, base=<optimized out>) at Objects/typeobject.c:4155
#4  0x00007f73f69c440e in PyType_Ready (type=type at entry=0x7f73e00456b0) at Objects/typeobject.c:4120
#5  0x00007f73f69c6d4b in type_new (metatype=<optimized out>, args=<optimized out>, kwds=<optimized out>) at Objects/typeobject.c:2467
#6  0x00007f73f69be7d3 in type_call (type=0x7f73f6cdad00 <PyType_Type>, args=0x7f73f61e1550, kwds=0x0) at Objects/typeobject.c:725
#7  0x00007f73f6954833 in PyObject_Call (func=func at entry=0x7f73f6cdad00 <PyType_Type>, arg=arg at entry=0x7f73f61e1550, kw=kw at entry=0x0) at Objects/abstract.c:2529
#8  0x00007f73f69553c9 in PyObject_CallFunctionObjArgs (callable=callable at entry=0x7f73f6cdad00 <PyType_Type>) at Objects/abstract.c:2760
#9  0x00007f73f6a06bf3 in build_class (name=<optimized out>, bases=0x7f73f61e3910, methods=0x7f73e0045590) at Python/ceval.c:4632
#10 PyEval_EvalFrameEx (f=f at entry=0x7f73e0043a40, throwflag=throwflag at entry=0) at Python/ceval.c:1928
#11 0x00007f73f6a0b46d in PyEval_EvalCodeEx (co=co at entry=0x7f73f61f50b0, globals=globals at entry=0x7f73e003bf00, locals=locals at entry=0x7f73e003bf00, args=args at entry=0x0, argcount=argcount at entry=0, 
    kws=kws at entry=0x0, kwcount=kwcount at entry=0, defs=defs at entry=0x0, defcount=defcount at entry=0, closure=closure at entry=0x0) at Python/ceval.c:3253
#12 0x00007f73f6a0b5a2 in PyEval_EvalCode (co=co at entry=0x7f73f61f50b0, globals=globals at entry=0x7f73e003bf00, locals=locals at entry=0x7f73e003bf00) at Python/ceval.c:667
#13 0x00007f73f6a22cfc in PyImport_ExecCodeModuleEx (name=name at entry=0x7f73e003d760 "warnings", co=co at entry=0x7f73f61f50b0, 
    pathname=pathname at entry=0x7f73e003ac90 "/usr/local/lib/python2.7/warnings.pyc") at Python/import.c:709
#14 0x00007f73f6a2305e in load_source_module (name=0x7f73e003d760 "warnings", pathname=0x7f73e003ac90 "/usr/local/lib/python2.7/warnings.pyc", fp=<optimized out>) at Python/import.c:1099
#15 0x00007f73f6a23f59 in import_submodule (mod=mod at entry=0x7f73f6cd2ec0 <_Py_NoneStruct>, subname=subname at entry=0x7f73e003d760 "warnings", fullname=fullname at entry=0x7f73e003d760 "warnings")
    at Python/import.c:2700
#16 0x00007f73f6a24b93 in load_next (p_buflen=<synthetic pointer>, buf=0x7f73e003d760 "warnings", p_name=<synthetic pointer>, altmod=0x7f73f6cd2ec0 <_Py_NoneStruct>, 
    mod=0x7f73f6cd2ec0 <_Py_NoneStruct>) at Python/import.c:2515
#17 import_module_level (locals=<optimized out>, level=<optimized out>, fromlist=0x7f73f6cd2ec0 <_Py_NoneStruct>, globals=<optimized out>, name=0x0) at Python/import.c:2224
#18 PyImport_ImportModuleLevel (name=0x7f73ff54fbf4 "warnings", globals=<optimized out>, locals=<optimized out>, fromlist=0x7f73f6cd2ec0 <_Py_NoneStruct>, level=<optimized out>)
    at Python/import.c:2288
#19 0x00007f73f6a033af in builtin___import__ (self=<optimized out>, args=<optimized out>, kwds=<optimized out>) at Python/bltinmodule.c:49
#61 0x00007f73f6a37dbc in initsite () at Python/pythonrun.c:721
#62 Py_InitializeEx (install_sigs=1) at Python/pythonrun.c:265

(full back trace is attached, it's quite long).

(gdb) py-bt
#10 Frame 0x7f4bf8043df0, for file /usr/lib64/python2.7/warnings.py, line 281, in <module> ()
    class WarningMessage(object):
#23 Frame 0x7f4bf803d300, for file /usr/lib64/python2.7/posixpath.py, line 17, in <module> ()
    import warnings
#36 Frame 0x7f4bf8024fc0, for file /usr/lib64/python2.7/os.py, line 49, in <module> ()
    import posixpath as path
#49 Frame 0x7f4bf801c520, for file /usr/lib64/python2.7/site.py, line 62, in <module> ()
    import os

I get the same crash with vanilla Python 2.7.4 without Fedora patches. Python 2.7.3 works well and doesn't crash.

components: Interpreter Core
files: full-bt.txt
messages: 188629
nosy: jsafrane
priority: normal
severity: normal
status: open
title: Crash in clear_weakref
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file30161/full-bt.txt

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list