[pypy-issue] [issue1178] adding support to lxml in pypy

Ian Delaney tracker at bugs.pypy.org
Sun Jun 17 09:04:44 CEST 2012


New submission from Ian Delaney <della5 at iinet.com.au>:

What do you make of this?

1. Copy descrobject.h from CPython 2.7 verbatim to pypy-1.8 headers.
2. Remove or comment out the definition of PyListObject in pypy_decl.h.
3. Copy the definition of PyListObject from CPython 2.7 to the end of descrobject.h.
4. Added #include "descrobject.h" to Python.h after #include "descrobject.h"


archtester lxml # USE_PYTHON="2.7 2.7-pypy-1.8" ebuild lxml-2.3.4.ebuild clean
install

running install_scripts
>>> Completed installing lxml-2.3.4 into
/mnt/gen2/TmpDir/portage/dev-python/lxml-2.3.4/image/

strip: x86_64-pc-linux-gnu-strip --strip-unneeded -R .comment -R .GCC.command.line
   /usr/lib64/python2.7/site-packages/lxml/etree.so
   /usr/lib64/python2.7/site-packages/lxml/objectify.so
   /usr/lib64/pypy1.8/site-packages/lxml/etree.pypy-18.so
   /usr/lib64/pypy1.8/site-packages/lxml/objectify.pypy-18.so

So; I have;

I would be very wary of runtime failures due to possible differences in the
CPython and PyPy structures.

This addition required only addition of header 1 python2.7 header file plus
PyListObject.  It required no changes to the source code of lxml's C source
code.  So it comes down to the suitability of the python2.7 data structure
structs being added verbatim to pypy headers.  Now while it appears to me to be
a reasonable match, I'm a pypy novice.

What do you make of it?  I am told upstream lxml maintainers are 'working on
it', but I managed this inside 3 days (probably because I'm a novice).  It's
fairly evident to me that making such additions have to be first valid data
structures to pypy and second not interfere or change anything else unintended.
 So perhaps the def of PyListObject need be encapsulated in a preprocessor
statement such as

#if defined PyListObject
#undef PyListObject
#endif

but then. I'm a novice.  I could not actually find this issue in lxml tracker re
adding pypy support,  but it seems there are 2 so it must be there somewhere.
Should pypy support be added in pypy itself, or is it best for the lxml
maintainers to either adjust its source code by adding the data structures to
its source code or adjusting it to accommodate pypy's already existing header
files?????

----------
messages: 4447
nosy: idella5, pypy-issue
priority: feature
release: 1.8
status: chatting
title: adding support to lxml in pypy

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1178>
________________________________________


More information about the pypy-issue mailing list