Skip to content
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

MNT: use compat functions for accessing dtype state #475

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 8 additions & 8 deletions numexpr/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define fmin min
#define NE_INFINITY (DBL_MAX+DBL_MAX)
#define NE_NAN (INFINITY-INFINITY)
#else
#else
#define NE_INFINITY INFINITY
#define NE_NAN NAN
#endif
Expand Down Expand Up @@ -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], (int)self->memsizes[1]);
} // no string temporaries, so no third case
}
if (dtypes[0] == NULL) {
Expand Down Expand Up @@ -1254,7 +1254,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
PyArrayObject *singleton;
bool writeback;
// NOTE: cannot assign on declaration due to `goto` statements
singleton = NULL;
singleton = NULL;
writeback = false;
if (n_inputs == 0) {
char retsig = get_return_sig(self->program);
Expand Down Expand Up @@ -1313,10 +1313,10 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
/* Allocate the iterator or nested iterators */
if (reduction_size < 0 || full_reduction) {
/* When there's no reduction, reduction_size is 1 as well */
// RAM: in issue #277 this was also the case for reductions on arrays
// with axis=0 having singleton dimension, i.e. such ops were interpreted
// as full_reductions when they weren't in Numpy. As such, the default
// reduction_size is now -1 and we add the flag for full_reduction,
// RAM: in issue #277 this was also the case for reductions on arrays
// with axis=0 having singleton dimension, i.e. such ops were interpreted
// as full_reductions when they weren't in Numpy. As such, the default
// reduction_size is now -1 and we add the flag for full_reduction,
// e.g. ne.evaluate("sum(a)")"
iter = NpyIter_AdvancedNew(n_inputs+1, operands,
NPY_ITER_BUFFERED|
Expand Down Expand Up @@ -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 */
Expand Down
Loading