Author: Stefan H. Muller <shmuell...@gmail.com>
Branch: pypy-pyarray
Changeset: r66334:3f9be1d43a61
Date: 2013-07-30 11:59 +0200
http://bitbucket.org/pypy/pypy/changeset/3f9be1d43a61/

Log:    - cpyext/ndarrayobject.py: Add support for PyArray_STRIDE() and
        PyArray_FromObject().
        - cpyext/include/numpy: Add constants needed by matplotlib.
        - cpyext/include/complexobject.h: Replace macro with function for
        const correctness.
        - lib_pypy/numpy.py: Add __version__. I felt like it's 1.6.2.

diff --git a/lib_pypy/numpy.py b/lib_pypy/numpy.py
--- a/lib_pypy/numpy.py
+++ b/lib_pypy/numpy.py
@@ -8,6 +8,8 @@
 
 import os
 
+__version__ = '1.6.2'
+
 def get_include():
     head, tail = os.path.split(os.path.dirname(os.path.abspath(__file__)))
     return os.path.join(head, 'include')
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,6 +7,10 @@
 extern "C" {
 #endif
 
+#include "old_defines.h"
+
+#define NPY_INLINE
+
 /* fake PyArrayObject so that code that doesn't do direct field access works */
 #define PyArrayObject PyObject
 
@@ -19,14 +23,20 @@
 
 #ifndef PyArray_NDIM
 
+#define PyArray_ISCONTIGUOUS(arr) (1)
+
 #define PyArray_NDIM     _PyArray_NDIM
 #define PyArray_DIM      _PyArray_DIM
+#define PyArray_STRIDE   _PyArray_STRIDE
 #define PyArray_SIZE     _PyArray_SIZE
 #define PyArray_ITEMSIZE _PyArray_ITEMSIZE
 #define PyArray_NBYTES   _PyArray_NBYTES
 #define PyArray_TYPE     _PyArray_TYPE
 #define PyArray_DATA     _PyArray_DATA
-#define PyArray_FromAny  _PyArray_FromAny
+
+#define PyArray_FromAny _PyArray_FromAny
+#define PyArray_FromObject _PyArray_FromObject
+#define PyArray_ContiguousFromObject PyArray_FromObject
 
 #define PyArray_SimpleNew _PyArray_SimpleNew
 #define PyArray_SimpleNewFromData _PyArray_SimpleNewFromData
@@ -63,6 +73,19 @@
                     NPY_NTYPES_ABI_COMPATIBLE=21
 };
 
+#define NPY_INT8      NPY_BYTE
+#define NPY_UINT8     NPY_UBYTE
+#define NPY_INT16     NPY_SHORT
+#define NPY_UINT16    NPY_USHORT
+#define NPY_INT32     NPY_INT
+#define NPY_UINT32    NPY_UINT
+#define NPY_INT64     NPY_LONG
+#define NPY_UINT64    NPY_ULONG
+#define NPY_FLOAT32   NPY_FLOAT
+#define NPY_FLOAT64   NPY_DOUBLE
+#define NPY_COMPLEX32 NPY_CFLOAT
+#define NPY_COMPLEX64 NPY_CDOUBLE
+
 #ifdef __cplusplus
 }
 #endif
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to