8000 BUG: Moved Py_DECREF out of block | Init for descr · numpy/numpy@52e8085 · GitHub
[go: up one dir, main page]

Skip to content

Commit 52e8085

Browse files
committed
BUG: Moved Py_DECREF out of block | Init for descr
1 parent af51386 commit 52e8085

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

numpy/core/src/umath/scalarmath.c.src

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ descr_from_basic_scalar(PyObject *obj, PyArray_Descr **descr)
630630
static PyObject*
631631
do_richcompare_on_scalars(PyObject *self, PyObject *other, int cmp_op) {
632632
PyObject *item_self, *ret;
633-
PyArray_Descr *self_descr, *other_descr;
633+
PyArray_Descr *self_descr=NULL, *other_descr=NULL;
634634
void *data_self;
635635
int pyscalar_other;
636636

@@ -640,13 +640,14 @@ do_richcompare_on_scalars(PyObject *self, PyObject *other, int cmp_op) {
640640
if (NPY_LIKELY(pyscalar_other > 0)) {
641641
data_self = scalar_value(self, NULL);
642642
item_self = self_descr->f->getitem(data_self, NULL);
643-
Py_DECREF(self_descr);
644643

645644
ret = PyObject_RichCompare(item_self, other, cmp_op);
646645
Py_DECREF(item_self);
647646

648647
return ret;
649648
}
649+
Py_DECREF(self_descr);
650+
Py_DECREF(other_descr);
650651

651652
return NULL;
652653
}

0 commit comments

Comments
 (0)
0