diff --git a/numexpr/interpreter.cpp b/numexpr/interpreter.cpp index 716d8ef..de4bf15 100644 --- a/numexpr/interpreter.cpp +++ b/numexpr/interpreter.cpp @@ -1203,7 +1203,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds) Py_INCREF(dtypes[0]); } else { // constant, like in '"foo"' dtypes[0] = PyArray_DescrNewFromType(NPY_STRING); - dtypes[0]->elsize = (int)self->memsizes[1]; + PyDataType_SET_ELSIZE(dtypes[0], (npy_intp)self->memsizes[1]); } // no string temporaries, so no third case } if (dtypes[0] == NULL) { @@ -1449,7 +1449,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds) /* Get the sizes of all the operands */ dtypes_tmp = NpyIter_GetDescrArray(iter); for (i = 0; i < n_inputs+1; ++i) { - self->memsizes[i] = dtypes_tmp[i]->elsize; + self->memsizes[i] = PyDataType_ELSIZE(dtypes_tmp[i]); } /* For small calculations, just use 1 thread */ diff --git a/pyproject.toml b/pyproject.toml index 3999a02..c57e423 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ [build-system] -requires = ["setuptools", "wheel", "oldest-supported-numpy"] +requires = [ + "setuptools", + "wheel", + "numpy>=2.0.0rc1", +] build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 1a276e7..6b5b554 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -numpy >= 1.13.3 +numpy >= 1.19.3 # keep in sync with NPY_TARGET_VERSION (setup.py) diff --git a/setup.py b/setup.py index 74c3383..33fd31d 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,10 @@ inc_dirs = [np.get_include()] libs = [] # Pre-built libraries ONLY, like python36.so clibs = [] -def_macros = [] +def_macros = [ + # keep in sync with minimal runtime requirement (requirements.txt) + ('NPY_TARGET_VERSION', 'NPY_1_19_API_VERSION') +] sources = ['numexpr/interpreter.cpp', 'numexpr/module.cpp', 'numexpr/numexpr_object.cpp']