[Cython] PyPy3 fixes

Lisandro Dalcin dalcinl at gmail.com
Sun Mar 8 20:25:01 CET 2015


1) Stefan, I had to push this fix, just to be sure, please double check.

https://github.com/cython/cython/commit/6bd3f7b9e494d1259082aecfc0366da15fc105ec

2) PyPy3 defines some legacy (Py2) Py_TPFLAGS_XXX values. Do you like
the following fix? IOW, I check if the value is #define'd, if not I
#define it to 0 (zero):

diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index 6477fb2..3ae8a0c 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -59,13 +59,16 @@
   #define __Pyx_DefaultClassType PyType_Type
 #endif

-#if PY_MAJOR_VERSION >= 3
+#if !defined(Py_TPFLAGS_CHECKTYPES)
   #define Py_TPFLAGS_CHECKTYPES 0
+#endif
+#if !defined(Py_TPFLAGS_HAVE_INDEX)
   #define Py_TPFLAGS_HAVE_INDEX 0
+#endif
+#if !defined(Py_TPFLAGS_HAVE_NEWBUFFER)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
-
-#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+#if !defined(Py_TPFLAGS_HAVE_FINALIZE)
   #define Py_TPFLAGS_HAVE_FINALIZE 0
 #endif


-- 
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Numerical Porous Media Center (NumPor)
King Abdullah University of Science and Technology (KAUST)
http://numpor.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 4332
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459


More information about the cython-devel mailing list