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

Stefan Behnel stefan_ml at behnel.de
Mon Mar 12 10:45:50 CET 2012

Amaury Forgeot d'Arc, 12.03.2012 10:33:
> 2012/3/12 Stefan Behnel:
>> 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.

Right, sure.

> 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.

Hmm, interesting. The test runner uses distutils. That means that it might
even work to let the test runner run normally in CPython and only resort to
PyPy for (1) building the module and (2) running the test. Might be some
work to set up, but could be worth it.



More information about the pypy-dev mailing list