[Cython] porting mpi4py to PyPy runtime
stefan_ml at behnel.de
Tue Nov 6 20:22:44 CET 2012
Lisandro Dalcin, 02.10.2012 17:06:
> After successfully porting mpi4py to PyPy 1.9, I want to share a few
> issues I've encountered. The most serious onesare on PyPy's side, but
> Cython do require a cuple of very minor fixes.
> 4) mpi4py uses @classmethod decorator for many methods in cdef
> classes. I really do not know what's going on, but method lookups do
> not return the classmethod, but the original "unwrapped" method. I've
> found a way to trick it, but again, I have no idea why it is working.
> Basically, I have to execute hasattr() (in Python code, not Cython
> code) on every class method: The hack reduces to adding the following
> code at the very end of Cython code (note that I'm using "exec"):
> if PYPY: exec """
> def _pypy_setup():
> for klass in (
> for name in klass.__dict__:
> meth = klass.__dict__[name]
> if (isinstance(meth, classmethod) or
> isinstance(meth, staticmethod)):
> hasattr(klass, name)
> del _pypy_setup
> I think (1) and (3) can be trivially handled in Cython, (3) is not an
> issue for Cython as PyBuffer_FillInfo() is not directly used. And
> about (4), we really need help from PyPy folks, they implement
> PyType_Modified() as a non-op
> but that is not playing well with Cython.
I had already opened a ticket for this one a while ago.
More information about the cython-devel