Skip to content

Commit b829b35

Browse files
Merge pull request #464 from 27rabbitlt/add_NE_MAXARGS
add NE_MAXARGS for future numpy change NPY_MAXARGS
2 parents 88ba205 + aa8b704 commit b829b35

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

numexpr/interpreter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -980,10 +980,10 @@ run_interpreter_const(NumExprObject *self, char *output, int *pc_error)
980980
PyObject *
981981
NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
982982
{
983-
PyArrayObject *operands[NPY_MAXARGS];
984-
PyArray_Descr *dtypes[NPY_MAXARGS], **dtypes_tmp;
983+
PyArrayObject *operands[NE_MAXARGS];
984+
PyArray_Descr *dtypes[NE_MAXARGS], **dtypes_tmp;
985985
PyObject *tmp, *ret;
986-
npy_uint32 op_flags[NPY_MAXARGS];
986+
npy_uint32 op_flags[NE_MAXARGS];
987987
NPY_CASTING casting = NPY_SAFE_CASTING;
988988
NPY_ORDER order = NPY_KEEPORDER;
989989
unsigned int i, n_inputs;
@@ -997,8 +997,8 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
997997
bool reduction_outer_loop = false, need_output_buffering = false, full_reduction = false;
998998

999999
// To specify axes when doing a reduction
1000-
int op_axes_values[NPY_MAXARGS][NPY_MAXDIMS],
1001-
op_axes_reduction_values[NPY_MAXARGS];
1000+
int op_axes_values[NE_MAXARGS][NPY_MAXDIMS],
1001+
op_axes_reduction_values[NE_MAXARGS];
10021002
int *op_axes_ptrs[NPY_MAXDIMS];
10031003
int oa_ndim = 0;
10041004
int **op_axes = NULL;

numexpr/numexpr_config.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
// environment variable, "NUMEXPR_MAX_THREADS"
2424
#define DEFAULT_MAX_THREADS 64
2525

26+
// Remove dependence on NPY_MAXARGS, which would be a runtime constant instead of compiletime
27+
// constant. If numpy raises NPY_MAXARGS, we should notice and raise this as well
28+
#define NE_MAXARGS 64
29+
2630
#if defined(_WIN32)
2731
#include "win32/pthread.h"
2832
#include <process.h>

0 commit comments

Comments
 (0)