
Martijn Faassen, 16.07.2011 13:44:
On 06/26/2011 09:42 AM, Stefan Behnel wrote:
F Wolff, 25.06.2011 15:31:
I've been watching the development of pypy with great interest. Over all the pyhton projects I contribute to, there are many modules that already work fine with pypy, with a few that don't. Lxml is our favourite library for XML handling, and we mostly gave up on etree compatibility some time ago to benefit from the best APIs in lxml.
So I'm curious to know if there are any plans to support lxml in pypy or any other ideas in this area that might be of interest. I don't have a burning need to run my software right now with pypy, but I'm interested in the possibility, as it seems quite mature and useful already.
There's a Cython port to ctypes on the way. It's a GSoC project that is specifically meant to provide a PyPy backend for Cython. Depending on the outcome, an lxml port to PyPy may become feasible.
Very, very cool!
Using Cython does open up different backend possibilities. I was very happily surprised that Python 3 was supported due to Cython, and now there's at least hope to make it work with PyPy.
Porting lxml directly to ctypes (as Jason suggested elsewhere in this thread) would be a huge job. There many subtle memory management issues in lxml that would need to be tackled very exactly all over again.
The Cython port actually goes through ctypes, for which PyPy appears to have efficient support. Note that it's not a goal of the port to make something like lxml portable, the only goal is to port Cython as an extension language for PyPy. I should state clearly here that this is only a part of the necessary work to port lxml to PyPy. At the current state of affairs, it's not even clear how complete the Cython port will be at the end of the GSoC, and if that's enough to start porting lxml. Even if it is, it's completely open how much needs to be done on the side of lxml, except that I already know that there *are* things to be done. And even if everything turns out to be doable, there's still the fact that someone actually has to do it. So don't expect a port any time soon. Stefan