[pypy-issue] Issue #2520: Missing marshal.h for PyMarshal_WriteObjectToString PyMarshal_ReadObjectFromString (pypy/pypy)
peterjc
issues-reply at bitbucket.org
Fri Mar 24 12:47:10 EDT 2017
New issue 2520: Missing marshal.h for PyMarshal_WriteObjectToString PyMarshal_ReadObjectFromString
https://bitbucket.org/pypy/pypy/issues/2520/missing-marshalh-for
peterjc:
Biopython releases until now have not attempted to compile any C extension code under PyPy. During the early days of PyPy we deliberately excluding them:
https://github.com/biopython/biopython/blob/biopython-168/setup.py#L416
However, in experiments with PyPy2 v5.6 and v5.7 compiling our C code mostly works, with the exception of:
```python
Extension('Bio.trie',
['Bio/triemodule.c',
'Bio/trie.c'],
include_dirs=["Bio"]
),
```
The following tests are from https://github.com/peterjc/biopython/commit/ce5eed17bffff7999d7c23ebcb01a0380f30c8fb which is/was a test branch with a modified ``setup.py`` to remove the PyPy skipping code.
e.g. https://travis-ci.org/peterjc/biopython/builds/214701332 vs https://travis-ci.org/peterjc/biopython/builds/214709981 where PyPy2 v5.7 (and PyPy3.5 v5.7 beta) both fail to compile ``Bio.trie``
Run locally to show the full details:
```
$ rm -rf build && ~/Downloads/pypy-5.7-linux_x86_64-portable/bin/pypy setup.py build
...
building 'Bio.trie' extension
gcc -pthread -DNDEBUG -O2 -fPIC -IBio -I/home/pc40583/Downloads/pypy-5.7-linux_x86_64-portable/include -c Bio/triemodule.c -o build/temp.linux-x86_64-2.7/Bio/triemodule.o
Bio/triemodule.c:2:21: error: marshal.h: No such file or directory
Bio/triemodule.c: In function ‘_write_value_to_handle’:
Bio/triemodule.c:630: warning: assignment makes pointer from integer without a cast
Bio/triemodule.c: In function ‘_read_value_from_handle’:
Bio/triemodule.c:735: warning: assignment makes pointer from integer without a cast
error: command 'gcc' failed with exit status 1
```
https://github.com/biopython/biopython/blob/biopython-168/Bio/triemodule.c starts:
```C
#include <Python.h>
#include <marshal.h>
#include "trie.h"
```
The C code references functions ``PyMarshal_WriteObjectToString`` and ``PyMarshal_ReadObjectFromString``, and constant ``Py_MARSHAL_VERSION``.
It appears PyPy only supports the Python level marshal interface defined in ``pypy/lib_pypy/_marshal.py``, and not the C level API?
The closest issue I could find on the PyPy tracker was #684.
More information about the pypy-issue
mailing list