Comment 1 for bug 1273709

scoder (scoder) wrote :

PyPy isn't currently tested, mostly because I don't have a CI server with a running PyPy installation (nor do I really care much about PyPy myself).

In any case, PyPy's C-API emulation isn't great (to put it *really* friendly), so this doesn't come unexpected. I've pushed a couple of fixes into Cython but can't test them. One is this:

"""
     } else
 #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */

+#if !CYTHON_COMPILING_IN_PYPY
 #if PY_VERSION_HEX >= 0x02060000
     if (PyByteArray_Check(o)) {
         *length = PyByteArray_GET_SIZE(o);
         return PyByteArray_AS_STRING(o);
     } else
 #endif
+#endif
     {
         char* result;
         int r = PyBytes_AsStringAndSize(o, &result, length);
"""

(i.e. add another preprocessor condition around the Py2.6 test) and the other is to replace all occurrences of "PyUnicode_Concat" by "PyNumber_Add" in the code. Both of these need to be done in lxml.etree.c and lxml.objectify.c.

Obviously, the correct place to fix these would be PyPy, but at least the work-arounds aren't difficult to implement.