@@ -5887,6 +5887,7 @@ static inline PyArrayObject *
5887
5887
new_array_op (PyArrayObject * op_array , char * data )
5888
5888
{
5889
5889
npy_intp dims [1 ] = {1 };
5890
+ Py_INCREF (PyArray_DESCR (op_array )); /* NewFromDescr steals a reference */
5890
5891
PyObject * r = PyArray_NewFromDescr (& PyArray_Type , PyArray_DESCR (op_array ),
5891
5892
1 , dims , NULL , data ,
5892
5893
NPY_ARRAY_WRITEABLE , NULL );
@@ -6033,14 +6034,11 @@ ufunc_at__slow_iter(PyUFuncObject *ufunc, NPY_ARRAYMETHOD_FLAGS flags,
6033
6034
}
6034
6035
array_operands [0 ] = new_array_op (op1_array , iter -> dataptr );
6035
6036
if (iter2 != NULL ) {
6036
- Py_INCREF (PyArray_DESCR (op2_array ));
6037
6037
array_operands [1 ] = new_array_op (op2_array , PyArray_ITER_DATA (iter2 ));
6038
- Py_INCREF (PyArray_DESCR (op1_array ));
6039
6038
array_operands [2 ] = new_array_op (op1_array , iter -> dataptr );
6040
6039
nop = 3 ;
6041
6040
}
6042
6041
else {
6043
- Py_INCREF (PyArray_DESCR (op1_array ));
6044
6042
array_operands [1 ] = new_array_op (op1_array , iter -> dataptr );
6045
6043
array_operands [2 ] = NULL ;
6046
6044
nop = 2 ;
@@ -6284,8 +6282,6 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args)
6284
6282
PyArrayMethodObject * ufuncimpl = NULL ;
6285
6283
{
6286
6284
/* Do all the dtype handling and find the correct ufuncimpl */
6287
- Py_INCREF (PyArray_DESCR (op1_array ));
6288
-
6289
6285
6290
6286
PyArrayObject * tmp_operands [3 ] = {NULL , NULL , NULL };
6291
6287
PyArray_DTypeMeta * signature [3 ] = {NULL , NULL , NULL };
0 commit comments