Author: mattip <[email protected]>
Branch: cpyext-ext
Changeset: r83756:625b0b723c5b
Date: 2016-04-19 01:46 +0300
http://bitbucket.org/pypy/pypy/changeset/625b0b723c5b/
Log: fix tests for -A
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
@@ -19,7 +19,6 @@
#define PyArray_SimpleNew _PyArray_SimpleNew
#define PyArray_ZEROS _PyArray_ZEROS
-#define PyArray_CopyInto _PyArray_CopyInto
#define PyArray_FILLWBYTE _PyArray_FILLWBYTE
#define NPY_MAXDIMS 32
diff --git a/pypy/module/cpyext/ndarrayobject.py
b/pypy/module/cpyext/ndarrayobject.py
--- a/pypy/module/cpyext/ndarrayobject.py
+++ b/pypy/module/cpyext/ndarrayobject.py
@@ -228,7 +228,7 @@
return simple_new(space, nd, dims, typenum,
order=order, owning=owning, w_subtype=w_subtype)
-@cpython_api([PyObject, PyObject], rffi.INT_real, error=-1)
+@cpython_api([PyObject, PyObject], rffi.INT_real, error=-1, header=HEADER)
def PyArray_CopyInto(space, w_dest, w_src):
assert isinstance(w_dest, W_NDimArray)
assert isinstance(w_src, W_NDimArray)
diff --git a/pypy/module/cpyext/src/ndarrayobject.c
b/pypy/module/cpyext/src/ndarrayobject.c
--- a/pypy/module/cpyext/src/ndarrayobject.c
+++ b/pypy/module/cpyext/src/ndarrayobject.c
@@ -17,10 +17,3 @@
return arr;
}
-int
-_PyArray_CopyInto(PyArrayObject* dest, PyArrayObject* src)
-{
- memcpy(_PyArray_DATA(dest), _PyArray_DATA(src), _PyArray_NBYTES(dest));
- return 0;
-}
-
diff --git a/pypy/module/cpyext/test/test_ndarrayobject.py
b/pypy/module/cpyext/test/test_ndarrayobject.py
--- a/pypy/module/cpyext/test/test_ndarrayobject.py
+++ b/pypy/module/cpyext/test/test_ndarrayobject.py
@@ -303,14 +303,19 @@
),
], include_dirs=self.numpy_include,
prologue='''
+ #ifdef PYPY_VERSION
+ #include <pypy_numpy.h>
+ #endif
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>
+ #ifdef PYPY_VERSION
+ #define PyArray_FromObject _PyArray_FromObject
+ #define PyArray_FromAny _PyArray_FromAny
+ #endif
''',
more_init = '''
- #ifndef PYPY_VER
+ #ifndef PYPY_VERSION
import_array();
- #else
- #include <pypy_numpy.h>
#endif
''')
arr = mod.test_simplenew()
@@ -343,14 +348,15 @@
'''),
], include_dirs=self.numpy_include,
prologue='''
+ #ifdef PYPY_VERSION
+ #include <pypy_numpy.h>
+ #endif
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>
''',
more_init = '''
- #ifndef PYPY_VER
+ #ifndef PYPY_VERSION
import_array();
- #else
- #include <pypy_numpy.h>
#endif
''')
array = ndarray((3, 4), dtype='d')
@@ -359,6 +365,7 @@
def test_ufunc(self):
if self.runappdirect:
+ from numpy import arange
py.test.xfail('why does this segfault on cpython?')
else:
from _numpypy.multiarray import arange
@@ -399,12 +406,13 @@
"""),
], include_dirs=self.numpy_include,
prologue='''
+ #ifdef PYPY_VERSION
+ #include <pypy_numpy.h>
+ #endif
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>
#ifndef PYPY_VERSION
#include <numpy/ufuncobject.h> /*generated by numpy setup.py*/
- #else
- #include <pypy_numpy.h>
#endif
typedef void (*PyUFuncGenericFunction)
(char **args,
@@ -471,7 +479,7 @@
};
''', more_init = '''
- #ifndef PYPY_VER
+ #ifndef PYPY_VERSION
import_array();
#endif
''')
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit