Stefan Behnel wrote: [snip]
It's consistently missing though in Python 2.3. Perhaps it accidentally gets turned off together with thread support? I did try to test this theory yesterday though on Python 2.4 by explicitly disabling tests, and that didn't help.
Ok, then, first thing to check: does "previousElement" turn up as a static function in the generated src/lxml/etree.h?
The only reference to previousElement (and nextElement) in etree.h are here: extern DL_IMPORT(xmlNode) (*(nextElement(xmlNode (*)))); extern DL_IMPORT(xmlNode) (*(previousElement(xmlNode (*))));
Could you check what the preprocessor sees in objectify.c (gcc -E)?
Hm, I wasn't previously familiar with gcc -E. I tried running it against objectify.c but got a lot of missing includes for Python and libxml2 (which is odd as these things are in /usr/include). I'm not quite sure how you generate your output, but here's my reference to previousElement when I do gcc -E: extern DL_IMPORT(xmlNode) (*(nextElement(xmlNode (*)))); extern DL_IMPORT(xmlNode) (*(previousElement(xmlNode (*)))); ... __pyx_v_next = nextElement; ... __pyx_v_next = previousElement; ... Hm, is it possible I'm using the wrong version of Pyrex? I have lxml's version installed for Python 2.4 but I guess I don't have that one for Python 2.3... Us having to maintain our own version of Pyrex rather sucks. I just installed lxml's version of Pyrex, and now the tests start. We still get some failures, though. Most of them are because 'assertFalse' doesn't appear to exist. I added this to HelperTestCase and made those errors go away. There's also the use of operator.itemgetter, which was only introduced in Python 2.4. I hacked up a simplistic implementation too. Now we're down to one failure in Python 2.3: ====================================================================== FAIL: test_findall (lxml.tests.test_objectify.ObjectifyTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/faassen/working/lxml/src/lxml/tests/test_objectify.py", line 218, in test_findall root.getchildren()[:2]) File "/usr/lib/python2.3/unittest.py", line 302, in failUnlessEqual raise self.failureException, \ AssertionError: [<Element b at b787f0cc>, ''] != [<Element b at b787f0cc>, ''] You'd think that this *should* be equal and thus succeed. Possibly some rich comparison feature that doesn't exist yet in Python 2.3? Back to you, Stephan. :) Regards, Martijn