Skip to content

Commit

Permalink
Merge pull request #19349 from charris/backport-19289
Browse files Browse the repository at this point in the history
BUG: Fix reference count leak in ufunc dtype handling
  • Loading branch information
charris committed Jun 25, 2021
2 parents b5e4172 + 70ac04c commit ff9f9aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion numpy/core/src/umath/ufunc_object.c
Expand Up @@ -4157,8 +4157,9 @@ PyUFunc_GenericReduction(PyUFuncObject *ufunc,
if (dtype == NULL) {
goto fail;
}
Py_INCREF(dtype->singleton);
otype = dtype->singleton;
Py_INCREF(otype);
Py_DECREF(dtype);
}
if (out_obj && !PyArray_OutputConverter(out_obj, &out)) {
goto fail;
Expand Down
1 change: 0 additions & 1 deletion numpy/core/src/umath/ufunc_type_resolution.c
Expand Up @@ -390,7 +390,6 @@ PyUFunc_SimpleBinaryComparisonTypeResolver(PyUFuncObject *ufunc,
operands, type_tup, out_dtypes);
}

Py_INCREF(descr);
out_dtypes[0] = ensure_dtype_nbo(descr);
if (out_dtypes[0] == NULL) {
return -1;
Expand Down

0 comments on commit ff9f9aa

Please sign in to comment.