Skip to content

Commit

Permalink
Merge pull request #464 from 27rabbitlt/add_NE_MAXARGS
Browse files Browse the repository at this point in the history
add NE_MAXARGS for future numpy change NPY_MAXARGS
  • Loading branch information
FrancescAlted authored Dec 11, 2023
2 parents 88ba205 + aa8b704 commit b829b35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 5 additions & 5 deletions numexpr/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -980,10 +980,10 @@ run_interpreter_const(NumExprObject *self, char *output, int *pc_error)
PyObject *
NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
{
PyArrayObject *operands[NPY_MAXARGS];
PyArray_Descr *dtypes[NPY_MAXARGS], **dtypes_tmp;
PyArrayObject *operands[NE_MAXARGS];
PyArray_Descr *dtypes[NE_MAXARGS], **dtypes_tmp;
PyObject *tmp, *ret;
npy_uint32 op_flags[NPY_MAXARGS];
npy_uint32 op_flags[NE_MAXARGS];
NPY_CASTING casting = NPY_SAFE_CASTING;
NPY_ORDER order = NPY_KEEPORDER;
unsigned int i, n_inputs;
Expand All @@ -997,8 +997,8 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
bool reduction_outer_loop = false, need_output_buffering = false, full_reduction = false;

// To specify axes when doing a reduction
int op_axes_values[NPY_MAXARGS][NPY_MAXDIMS],
op_axes_reduction_values[NPY_MAXARGS];
int op_axes_values[NE_MAXARGS][NPY_MAXDIMS],
op_axes_reduction_values[NE_MAXARGS];
int *op_axes_ptrs[NPY_MAXDIMS];
int oa_ndim = 0;
int **op_axes = NULL;
Expand Down
4 changes: 4 additions & 0 deletions numexpr/numexpr_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
// environment variable, "NUMEXPR_MAX_THREADS"
#define DEFAULT_MAX_THREADS 64

// Remove dependence on NPY_MAXARGS, which would be a runtime constant instead of compiletime
// constant. If numpy raises NPY_MAXARGS, we should notice and raise this as well
#define NE_MAXARGS 64

#if defined(_WIN32)
#include "win32/pthread.h"
#include <process.h>
Expand Down

0 comments on commit b829b35

Please sign in to comment.