Skip to content

Commit

Permalink
refactor bugfix #201
Browse files Browse the repository at this point in the history
  • Loading branch information
kwgoodman committed Jan 4, 2019
1 parent 25402b7 commit 3dec62b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions bottleneck/src/reduce_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,6 @@ reducer(char *name,
int dtype;
int ddof;
int reduce_all = 0;
int decref_a = 0;

PyArrayObject *a;
static PyObject *y;
Expand All @@ -1235,12 +1234,12 @@ reducer(char *name,
/* convert to array if necessary */
if PyArray_Check(a_obj) {
a = (PyArrayObject *)a_obj;
Py_INCREF(a);
} else {
a = (PyArrayObject *)PyArray_FROM_O(a_obj);
if (a == NULL) {
return NULL;
}
decref_a = 1;
}

/* check for byte swapped input array */
Expand Down Expand Up @@ -1328,9 +1327,7 @@ reducer(char *name,

}

if (decref_a == 1) {
Py_DECREF(a); \
}
Py_DECREF(a);

return y;

Expand Down

0 comments on commit 3dec62b

Please sign in to comment.