Skip to content

Commit 23d1a0e

Browse files
Merge pull request #478 from neutrinoceros/bld/build_with_numpy2.0.0rc1
BLD: build with numpy instead of oldest-supported-numpy
2 parents 20012fc + beedecb commit 23d1a0e

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

numexpr/interpreter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
12031203
Py_INCREF(dtypes[0]);
12041204
} else { // constant, like in '"foo"'
12051205
dtypes[0] = PyArray_DescrNewFromType(NPY_STRING);
1206-
dtypes[0]->elsize = (int)self->memsizes[1];
1206+
PyDataType_SET_ELSIZE(dtypes[0], (npy_intp)self->memsizes[1]);
12071207
} // no string temporaries, so no third case
12081208
}
12091209
if (dtypes[0] == NULL) {
@@ -1449,7 +1449,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
14491449
/* Get the sizes of all the operands */
14501450
dtypes_tmp = NpyIter_GetDescrArray(iter);
14511451
for (i = 0; i < n_inputs+1; ++i) {
1452-
self->memsizes[i] = dtypes_tmp[i]->elsize;
1452+
self->memsizes[i] = PyDataType_ELSIZE(dtypes_tmp[i]);
14531453
}
14541454

14551455
/* For small calculations, just use 1 thread */

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
[build-system]
2-
requires = ["setuptools", "wheel", "oldest-supported-numpy"]
2+
requires = [
3+
"setuptools",
4+
"wheel",
5+
"numpy>=2.0.0rc1",
6+
]
37
build-backend = "setuptools.build_meta"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
numpy >= 1.13.3
1+
numpy >= 1.19.3 # keep in sync with NPY_TARGET_VERSION (setup.py)

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
inc_dirs = [np.get_include()]
3434
libs = [] # Pre-built libraries ONLY, like python36.so
3535
clibs = []
36-
def_macros = []
36+
def_macros = [
37+
# keep in sync with minimal runtime requirement (requirements.txt)
38+
('NPY_TARGET_VERSION', 'NPY_1_19_API_VERSION')
39+
]
3740
sources = ['numexpr/interpreter.cpp',
3841
'numexpr/module.cpp',
3942
'numexpr/numexpr_object.cpp']

0 commit comments

Comments
 (0)