Hi,

I'm trying to get p4python (perforce python API) compiling with pypy and I notice that the include headers in pypy are very different than the standard 3.2.5 python headers. Is the C api different for pypy3 from python 3.2.5?

For example, note the following diffs:

---------------------------------------------------------------------------------------------------
diff -c `find . -name moduleobject.h`
*** ./pypy3-2.3.1-linux-armhf-raspbian/include/moduleobject.h 2014-06-19 09:20:58.000000000 -0700 --- ./Python-3.2.5/Include/moduleobject.h 2013-05-15 09:33:41.000000000 -0700
***************
*** 1,3 ****
--- 1,4 ----
+
  /* Module object interface */

  #ifndef Py_MODULEOBJECT_H
***************
*** 6,11 ****
--- 7,30 ----
  extern "C" {
  #endif

+ PyAPI_DATA(PyTypeObject) PyModule_Type;
+
+ #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
+ #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type)
+
+ PyAPI_FUNC(PyObject *) PyModule_New(
+     const char *name            /* UTF-8 encoded string */
+     );
+ PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
+ PyAPI_FUNC(const char *) PyModule_GetName(PyObject *);
+ PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
+ PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *);
+ #ifndef Py_LIMITED_API
+ PyAPI_FUNC(void) _PyModule_Clear(PyObject *);
+ #endif
+ PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*);
+ PyAPI_FUNC(void*) PyModule_GetState(PyObject*);
+
  typedef struct PyModuleDef_Base {
    PyObject_HEAD
    PyObject* (*m_init)(void);
***************
*** 32,37 ****
--- 51,57 ----
    freefunc m_free;
  }PyModuleDef;

+
  #ifdef __cplusplus
  }
  #endif
---------------------------------------------------------------------------------------------------

When I compile against the distributed pypy3 headers, I get errors:

---------------------------------------------------------------------------------------------------
08/09/14.12:11:29: Building p4python ...

08/09/14.12:11:29: pypy setup.py build --apidir ../p4api-2014.1.886167.main/ --ssl
API Release 2014.1
running build
running build_py
creating build
creating build/lib.linux-armv6l-3.2
copying P4.py -> build/lib.linux-armv6l-3.2
running build_ext
building 'P4API' extension
creating build/temp.linux-armv6l-3.2
cc -O2 -fPIC -Wimplicit -DID_OS="LINUX31ARM" -DID_REL="2012.2" -DID_PATCH="549493" -DID_API="2014.1.main/886167" -DID_Y="2012" -DID_M="11" -DID_D="05" -I../p4api-2014.1.886167.main/ -I../p4api-2014.1.886167.main/include/p4 -I/usr/local/pypy3-2.3.1-linux-armhf-raspbian/include -c P4API.cpp -o build/temp.linux-armv6l-3.2/P4API.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXARM -DOS_LINUX31ARM cc1plus: warning: command line option '-Wimplicit' is valid for C/ObjC but not for C++ [enabled by default]
P4API.cpp: In function 'int P4API_traverse(PyObject*, visitproc, void*)':
P4API.cpp:984:5: error: 'PyModule_GetState' was not declared in this scope
P4API.cpp: In function 'int P4API_clear(PyObject*)':
P4API.cpp:989:5: error: 'PyModule_GetState' was not declared in this scope
P4API.cpp: In function 'PyObject* PyInit_P4API()':
P4API.cpp:1045:30: error: 'PyModule_GetState' was not declared in this scope
error: command 'cc' failed with exit status 1

raspberrypi{gfinstall.5} pypy --version
Python 3.2.5 (986752d005bb, Jun 19 2014, 16:20:03)
[PyPy 2.3.1 with GCC 4.7.2 20120731 (prerelease)]
---------------------------------------------------------------------------------------------------

If I hack around the macro problems, I can get a compile, but then I get a runtime error:

---------------------------------------------------------------------------------------------------
raspberrypi{gfinstall.42} cat p4python_version_check.py
import P4
print(P4.P4.identify())

raspberrypi{gfinstall.43} pypy p4python_version_check.py
Traceback (most recent call last):
  File "p4python_version_check.py", line 1, in <module>
    import P4
File "/home/pi/git-fusion/bin/p4python-2012.2.549493/P4.py", line 359, in <module>
    import P4API
ImportError: unable to load extension module '/home/pi/git-fusion/bin/p4python-2012.2.549493/P4API.pypy3-23.so': /home/pi/git-fusion/bin/p4python-2012.2.549493/P4API.pypy3-23.so: undefined symbol: __cxa_pure_virtual
---------------------------------------------------------------------------------------------------

Any help appreciated..

tia,
-Russ
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to