[pypy-commit] pypy pypy-pyarray: - Add missing symbols for importing matplotlib.

shmuller noreply at buildbot.pypy.org
Mon Aug 26 22:02:52 CEST 2013


Author: Stefan H. Muller <shmueller2 at gmail.com>
Branch: pypy-pyarray
Changeset: r66340:ca566c12805d
Date: 2013-08-01 08:54 +0200
http://bitbucket.org/pypy/pypy/changeset/ca566c12805d/

Log:	- Add missing symbols for importing matplotlib.

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -401,6 +401,16 @@
     'PyThread_ReInitTLS',
 
     'PyStructSequence_InitType', 'PyStructSequence_New',
+
+    'PyFunction_Type', 'PyMethod_Type', 'PyRange_Type', 'PyTraceBack_Type',
+    
+    'PyArray_ZEROS',
+
+    'Py_DebugFlag', 'Py_VerboseFlag', 'Py_InteractiveFlag', 'Py_InspectFlag',
+    'Py_OptimizeFlag', 'Py_NoSiteFlag', 'Py_BytesWarningFlag', 'Py_UseClassExceptionsFlag', 
+    'Py_FrozenFlag', 'Py_TabcheckFlag', 'Py_UnicodeFlag', 'Py_IgnoreEnvironmentFlag', 
+    'Py_DivisionWarningFlag', 'Py_DontWriteBytecodeFlag', 'Py_NoUserSiteDirectory', 
+    '_Py_QnewFlag', 'Py_Py3kWarningFlag', 'Py_HashRandomizationFlag', '_Py_PackageContext',
 ]
 TYPES = {}
 GLOBALS = { # this needs to include all prebuilt pto, otherwise segfaults occur
@@ -990,6 +1000,8 @@
                                source_dir / "capsule.c",
                                source_dir / "pysignals.c",
                                source_dir / "pythread.c",
+                               source_dir / "ndarrayobject.c",
+                               source_dir / "missing.c",
                                ],
         separate_module_sources=separate_module_sources,
         export_symbols=export_symbols_eci,
diff --git a/pypy/module/cpyext/include/missing.h b/pypy/module/cpyext/include/missing.h
--- a/pypy/module/cpyext/include/missing.h
+++ b/pypy/module/cpyext/include/missing.h
@@ -7,7 +7,9 @@
 extern "C" {
 #endif
 
-PyAPI_DATA(PyTypeObject) PyMethod_Type, PyRange_Type, PyTraceBack_Type;
+PyAPI_DATA(PyTypeObject) PyMethod_Type;
+PyAPI_DATA(PyTypeObject) PyRange_Type;
+PyAPI_DATA(PyTypeObject) PyTraceBack_Type;
 
 #ifdef __cplusplus
 }
diff --git a/pypy/module/cpyext/include/numpy/arrayobject.h b/pypy/module/cpyext/include/numpy/arrayobject.h
--- a/pypy/module/cpyext/include/numpy/arrayobject.h
+++ b/pypy/module/cpyext/include/numpy/arrayobject.h
@@ -7,8 +7,6 @@
 extern "C" {
 #endif
 
-#include <string.h>   /* memset */
-
 #include "old_defines.h"
 
 #define NPY_INLINE
@@ -116,16 +114,7 @@
 #define PyArray_EMPTY(nd, dims, type_num, fortran) \
         PyArray_SimpleNew(nd, dims, type_num)
 
-#define PyArray_ZEROS PyArray_EMPTY
-
-/*
-PyObject* PyArray_ZEROS(int nd, npy_intp* dims, int type_num, int fortran) 
-{
-    PyObject *arr = PyArray_EMPTY(nd, dims, type_num, fortran);
-    memset(PyArray_DATA(arr), 0, PyArray_NBYTES(arr));
-    return arr;
-};
-*/
+PyObject* PyArray_ZEROS(int nd, npy_intp* dims, int type_num, int fortran);
 
 #define PyArray_Resize(self, newshape, refcheck, fortran) (NULL)
 
diff --git a/pypy/module/cpyext/include/pythonrun.h b/pypy/module/cpyext/include/pythonrun.h
--- a/pypy/module/cpyext/include/pythonrun.h
+++ b/pypy/module/cpyext/include/pythonrun.h
@@ -8,15 +8,6 @@
 
 void Py_FatalError(const char *msg);
 
-/* the -3 option will probably not be implemented */
-/*
-#define Py_Py3kWarningFlag 0
-
-#define Py_FrozenFlag 0
-#define Py_VerboseFlag 0
-#define Py_DebugFlag 1
-*/
-
 /* taken from Python-2.7.3/Include/pydebug.h */
 PyAPI_DATA(int) Py_DebugFlag;
 PyAPI_DATA(int) Py_VerboseFlag;
diff --git a/pypy/module/cpyext/src/missing.c b/pypy/module/cpyext/src/missing.c
new file mode 100644
--- /dev/null
+++ b/pypy/module/cpyext/src/missing.c
@@ -0,0 +1,29 @@
+/* Definitions of missing symbols go here */
+
+#include "Python.h"
+
+PyTypeObject PyFunction_Type;
+
+PyTypeObject PyMethod_Type;
+PyTypeObject PyRange_Type;
+PyTypeObject PyTraceBack_Type;
+
+int Py_DebugFlag = 1;
+int Py_VerboseFlag = 0;
+int Py_InteractiveFlag = 0;
+int Py_InspectFlag = 0;
+int Py_OptimizeFlag = 0;
+int Py_NoSiteFlag = 0;
+int Py_BytesWarningFlag = 0;
+int Py_UseClassExceptionsFlag = 0;
+int Py_FrozenFlag = 0;
+int Py_TabcheckFlag = 0;
+int Py_UnicodeFlag = 0;
+int Py_IgnoreEnvironmentFlag = 0;
+int Py_DivisionWarningFlag = 0;
+int Py_DontWriteBytecodeFlag = 0;
+int Py_NoUserSiteDirectory = 0;
+int _Py_QnewFlag = 0;
+int Py_Py3kWarningFlag = 0;
+int Py_HashRandomizationFlag = 0;
+
diff --git a/pypy/module/cpyext/src/ndarrayobject.c b/pypy/module/cpyext/src/ndarrayobject.c
new file mode 100644
--- /dev/null
+++ b/pypy/module/cpyext/src/ndarrayobject.c
@@ -0,0 +1,13 @@
+
+#include "Python.h"
+#include "numpy/arrayobject.h"
+#include <string.h>   /* memset */
+
+PyObject* 
+PyArray_ZEROS(int nd, npy_intp* dims, int type_num, int fortran) 
+{
+    PyObject *arr = PyArray_EMPTY(nd, dims, type_num, fortran);
+    memset(PyArray_DATA(arr), 0, PyArray_NBYTES(arr));
+    return arr;
+}
+


More information about the pypy-commit mailing list