Skip to content

MAINT: Update to use current Numpy API #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions numexpr/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
// Convert it if it's not an array
if (!PyArray_Check(o)) {
if (typecode == -1) goto fail;
a = PyArray_FROM_OTF(o, typecode, NPY_NOTSWAPPED);
a = PyArray_FROM_OTF(o, typecode, NPY_ARRAY_NOTSWAPPED);
}
else {
Py_INCREF(o);
Expand Down Expand Up @@ -1178,7 +1178,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
dtypes[0] = PyArray_DESCR(operands[1]);
Py_INCREF(dtypes[0]);
} else { // constant, like in '"foo"'
dtypes[0] = PyArray_DescrNewFromType(PyArray_STRING);
dtypes[0] = PyArray_DescrNewFromType(NPY_STRING);
dtypes[0]->elsize = (int)self->memsizes[1];
} // no string temporaries, so no third case
}
Expand Down Expand Up @@ -1253,7 +1253,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
}
Py_INCREF(dtypes[0]);
a = (PyArrayObject *)PyArray_FromArray(operands[0], dtypes[0],
NPY_ALIGNED|NPY_UPDATEIFCOPY);
NPY_ARRAY_ALIGNED|NPY_ARRAY_UPDATEIFCOPY);
if (a == NULL) {
goto fail;
}
Expand Down
2 changes: 1 addition & 1 deletion numexpr/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ extern "C" {

#if PY_MAJOR_VERSION >= 3

/* XXX: handle the "global_state" state via moduedef */
/* XXX: handle the "global_state" state via moduledef */
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"interpreter",
Expand Down
2 changes: 2 additions & 0 deletions numexpr/module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# define NO_IMPORT_ARRAY
#endif

#define NPY_NO_DEPRECATED_API NPY_API_VERSION

#include <Python.h>
#include <numpy/ndarrayobject.h>
#include <numpy/arrayscalars.h>
Expand Down