[Python-Dev] crash in dict on gc collect

Neal Norwitz nnorwitz at gmail.com
Tue Jun 13 09:43:57 CEST 2006


# This crashes, but i need to print type(encoding_table) at end of cp1140.py
import imp, sys
path = sys.path

enc = imp.find_module('encodings')
imp.load_module('encodings', *enc)

path.append(enc[1])

cp1140 = imp.find_module('cp1140')
imp.load_module('cp1140', *cp1140)

###

0x0000000000465689 in PyType_IsSubtype (a=0x0, b=0x663f60) at typeobject.c:816
816             if (!(a->tp_flags & Py_TPFLAGS_HAVE_CLASS))
(gdb) bt
#0  0x0000000000465689 in PyType_IsSubtype (a=0x0, b=0x663f60)
    at typeobject.c:816
#1  0x000000000042bd7a in PyFile_WriteObject (v=0x6615a0, f=0x2a9557a238,
    flags=1) at fileobject.c:2159
#2  0x0000000000496ddf in PyEval_EvalFrameEx (f=0x7359a0, throwflag=0)
    at ceval.c:1570
#3  0x000000000049c352 in PyEval_EvalCodeEx (co=0x2a95dec6d0,
    globals=0x722420, locals=0x722420, args=0x0, argcount=0, kws=0x0,
    kwcount=0, defs=0x0, defcount=0, closure=0x0) at ceval.c:2841
#4  0x0000000000492b9c in PyEval_EvalCode (co=0x2a95dec6d0, globals=0x722420,
    locals=0x722420) at ceval.c:503
#5  0x00000000004b6821 in PyImport_ExecCodeModuleEx (
    name=0x2a95ded434 "cp1140", co=0x2a95dec6d0,
    pathname=0x2a95dd6d84 "Lib/encodings/cp1140.py") at import.c:642
#6  0x00000000004b6ff8 in load_source_module (name=0x2a95ded434 "cp1140",
    pathname=0x2a95dd6d84 "Lib/encodings/cp1140.py", fp=0x731d10) at
import.c:923


On 6/11/06, Neal Norwitz <nnorwitz at gmail.com> wrote:
> I wonder if this is similar to Kevin's problem?  I couldn't reproduce
> his problem though.  This happens with both debug and release builds.
> Not sure how to reduce the test case.  pychecker was just iterating
> through the byte codes.  It wasn't doing anything particularly
> interesting.
>
> ./python pychecker/pychecker/checker.py Lib/encodings/cp1140.py
>
> 0x00000000004cfa18 in visit_decref (op=0x661180, data=0x0) at gcmodule.c:270
> 270             if (PyObject_IS_GC(op)) {
> (gdb) bt
> #0  0x00000000004cfa18 in visit_decref (op=0x661180, data=0x0) at gcmodule.c:270
> #1  0x00000000004474ab in dict_traverse (op=0x7cdd90,  visit=0x4cf9e0
> <visit_decref>, arg=0x0) at dictobject.c:1819
> #2  0x00000000004cfaf0 in subtract_refs (containers=0x670240) at gcmodule.c:295
> #3  0x00000000004d07fd in collect (generation=0) at gcmodule.c:790
> #4  0x00000000004d0ad1 in collect_generations () at gcmodule.c:897
> #5  0x00000000004d1505 in _PyObject_GC_Malloc (basicsize=56) at gcmodule.c:1332
> #6  0x00000000004d1542 in _PyObject_GC_New (tp=0x64f4a0) at gcmodule.c:1342
> #7  0x000000000041d992 in PyInstance_NewRaw (klass=0x2a95dffcc0,
> dict=0x800e80) at classobject.c:505
> #8  0x000000000041dab8 in PyInstance_New (klass=0x2a95dffcc0,
> arg=0x2a95f5f9e0, kw=0x0) at classobject.c:525
> #9  0x000000000041aa4e in PyObject_Call (func=0x2a95dffcc0,
> arg=0x2a95f5f9e0,  kw=0x0) at abstract.c:1802
> #10 0x000000000049ecd2 in do_call (func=0x2a95dffcc0,
> pp_stack=0x7fbfffb5b0,  na=3, nk=0) at ceval.c:3785
> #11 0x000000000049e46f in call_function (pp_stack=0x7fbfffb5b0,
> oparg=3) at ceval.c:3597
>


More information about the Python-Dev mailing list