Hi All,

First of all, I'm not opening a bug yet as I'm not certain whether this is
a CPython bug or lxml bug.

I'm getting a segfault within python's GC (garbage collector) module.
here's the stack trace:

#0  0x00007fc7e9f6b76e in gc_list_remove (op=0x7fc79cef3d98) at
Modules/gcmodule.c:211
#1  PyObject_GC_Del (op=0x7fc79cef3d98) at Modules/gcmodule.c:1503
#2  0x00007fc7e9f2ac0f in PyEval_EvalFrameEx (f=<value optimized out>,
throwflag=<value optimized out>) at Python/ceval.c:2894
#3  0x00007fc7e9ea5b79 in gen_send_ex (arg=None, exc=<value optimized out>,
gen=<value optimized out>) at Objects/genobject.c:84
#4  0x00007fc7e9ea6185 in gen_close (self=<generator at remote
0x7fc7c1ba73c0>) at Objects/genobject.c:130
#5  gen_del (self=<generator at remote 0x7fc7c1ba73c0>) at
Objects/genobject.c:165
#6  0x00007fc7e9ea5a1b in gen_dealloc (gen=0x7fc7c1ba73c0) at
Objects/genobject.c:32

In order to see what object the gc is freeing i tried casting it to a
PyObject (we're freeing a lxml object):
(gdb) p (PyObject*) op
$17 = <ml.etree.DocInfo.standalone.__get__ at remote 0x7fc79cef3d98>

Similar bugs (http://osdir.com/ml/python.bugs/2000-12/msg00214.html) blame
the extension module for calling dealloc explicitly more than once or doing
forbidden things in __del__.

this is how i use lxml:

from lxml.etree import iterparse

def safe_iterparse(*args, **kwargs):
    for event, element in iterparse(*args, **kwargs):
        try:
            yield (event, element)
        finally:
            element.clear()

I don't have the data that caused the crash, hopefully I'll get it after
the next crash.
anyone familiar with these kind of bugs in c extensions/cpython/lxml? could
you give pointers to what I should be looking for?

some version info:
CPython version: 2.7.2 on linux.
lxml: 2.3.3


                                      thanks, Alon Horev
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to