[pypy-dev] "import signal" fails when running PyPy interpreted

Amaury Forgeot d'Arc amauryfa at gmail.com
Mon Mar 12 10:33:11 CET 2012

2012/3/12 Stefan Behnel <stefan_ml at behnel.de>:
> Is there a way to manually compile a C module against a PyPy-in-sources
> that allows importing it afterwards? Then I could just compile the test
> normally (and quickly) in CPython and then recompile the C code manually
> for PyPy. I tried, but it didn't work so far. What I tried was:

Keep in mind that "manual" ways won't work because of symbols collision:
you want PyString_FromString() call some PyPy function, not the one
exposed by the
host CPython you are running py.py with.

There is a way to do it though, for distutils-based projects: a
"presetup.py" will tweak
distutils to compile .pypy-18i.so files:
   python /path/to/pypy/module/cpyext/presetup.py setup.py build_ext
The "i" in ".pypy-18i.so" stands for "interpreted", i.e. not
translated pypy. All symbols
are renamed (PyPyString_FromString), and the resulting files can be
imported in py.py.
This is how I debugged lxml, for example.

Amaury Forgeot d'Arc

More information about the pypy-dev mailing list