Skip to content

Commit f91a2d3

Browse files
Merge pull request #228 from oleksandr-pavlyk/feature/upgrade-numpy-api
MAINT: Update to use current Numpy API
2 parents 2282645 + f81fe92 commit f91a2d3

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

numexpr/interpreter.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
10491049
// Convert it if it's not an array
10501050
if (!PyArray_Check(o)) {
10511051
if (typecode == -1) goto fail;
1052-
a = PyArray_FROM_OTF(o, typecode, NPY_NOTSWAPPED);
1052+
a = PyArray_FROM_OTF(o, typecode, NPY_ARRAY_NOTSWAPPED);
10531053
}
10541054
else {
10551055
Py_INCREF(o);
@@ -1178,7 +1178,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
11781178
dtypes[0] = PyArray_DESCR(operands[1]);
11791179
Py_INCREF(dtypes[0]);
11801180
} else { // constant, like in '"foo"'
1181-
dtypes[0] = PyArray_DescrNewFromType(PyArray_STRING);
1181+
dtypes[0] = PyArray_DescrNewFromType(NPY_STRING);
11821182
dtypes[0]->elsize = (int)self->memsizes[1];
11831183
} // no string temporaries, so no third case
11841184
}
@@ -1253,7 +1253,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
12531253
}
12541254
Py_INCREF(dtypes[0]);
12551255
a = (PyArrayObject *)PyArray_FromArray(operands[0], dtypes[0],
1256-
NPY_ALIGNED|NPY_UPDATEIFCOPY);
1256+
NPY_ARRAY_ALIGNED|NPY_ARRAY_UPDATEIFCOPY);
12571257
if (a == NULL) {
12581258
goto fail;
12591259
}

numexpr/module.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ extern "C" {
357357

358358
#if PY_MAJOR_VERSION >= 3
359359

360-
/* XXX: handle the "global_state" state via moduedef */
360+
/* XXX: handle the "global_state" state via moduledef */
361361
static struct PyModuleDef moduledef = {
362362
PyModuleDef_HEAD_INIT,
363363
"interpreter",

numexpr/module.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# define NO_IMPORT_ARRAY
99
#endif
1010

11+
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
12+
1113
#include <Python.h>
1214
#include <numpy/ndarrayobject.h>
1315
#include <numpy/arrayscalars.h>

0 commit comments

Comments
 (0)