
Hi Holger,
Holger Joukl wrote:
lxml.objectify crashes under python2.3:
PYTHONPATH=/apps/pydev/gcc/3.4.4/lib/python2.4/site-packages/ python2.3 Python 2.3.4 (#6, Jul 20 2004, 11:09:38) [GCC 2.95.2 19991024 (release)] on sunos5 Type "help", "copyright", "credits" or "license" for more information.
import lxml.objectify
Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: ld.so.1: python2.3: fatal: relocation error: file /apps/pydev/gcc/3.4.4/lib/python2.4/site-packages/lxml/objectify.so: symbol PyDict_Contains: referenced symbol not found
Besides the fact that you should not normally import modules that were compiled for a different Python version - you're right, thanks. That one slipped through accidentally.
Here's the patch.
Stefan
Index: src/lxml/objectify.pyx =================================================================== --- src/lxml/objectify.pyx (Revision 31226) +++ src/lxml/objectify.pyx (Arbeitskopie) @@ -184,7 +184,7 @@ if c_ns is NULL and tree._getNs(child._c_node) is not NULL: continue name = child._c_node.name - if not python.PyDict_Contains(children, name): + if python.PyDict_GetItem(children, name) is NULL: python.PyDict_SetItem(children, name, child) return children
Index: src/lxml/python.pxd =================================================================== --- src/lxml/python.pxd (Revision 31212) +++ src/lxml/python.pxd (Arbeitskopie) @@ -52,7 +52,6 @@ cdef void PyDict_Clear(object d) cdef object PyDict_Copy(object d) cdef Py_ssize_t PyDict_Size(object d) - cdef int PyDict_Contains(object d, object key) cdef object PySequence_List(object o) cdef object PySequence_Tuple(object o)