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 ( > Status, > Datatype, > Request, > Message, > Op, > Group, > Info, > Errhandler, > Comm, > Win, > File, > ): > for name in klass.__dict__: > meth = klass.__dict__[name] > if (isinstance(meth, classmethod) or > isinstance(meth, staticmethod)): > hasattr(klass, name) > _pypy_setup() > 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 > (https://bitbucket.org/pypy/pypy/src/release-1.9/pypy/module/cpyext/typeobject.py#cl-726) > but that is not playing well with Cython.
https://bugs.pypy.org/issue1106 I had already opened a ticket for this one a while ago. Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel