Commit acd3fdcb authored by Stefan Behnel's avatar Stefan Behnel

Fix a reference leak when PyList_Append() fails.

parent bf61b1c5
...@@ -972,14 +972,15 @@ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx) ...@@ -972,14 +972,15 @@ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx)
if (PyTuple_Check(idx)) { if (PyTuple_Check(idx)) {
PyObject *list = PyList_New(0); PyObject *list = PyList_New(0);
Py_ssize_t n = PyTuple_GET_SIZE(idx); Py_ssize_t n = PyTuple_GET_SIZE(idx);
PyObject *string = NULL;
PyObject *sep = NULL; PyObject *sep = NULL;
int i; int i;
if (!list) if (unlikely(!list))
return NULL; return NULL;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
int ret;
PyObject *string;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
PyObject *item = PyTuple_GET_ITEM(idx, i); PyObject *item = PyTuple_GET_ITEM(idx, i);
#else #else
...@@ -989,14 +990,14 @@ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx) ...@@ -989,14 +990,14 @@ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx)
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
Py_DECREF(item); Py_DECREF(item);
#endif #endif
if (!string || PyList_Append(list, string) < 0) if (unlikely(!string)) goto __pyx_err;
goto __pyx_err; ret = PyList_Append(list, string);
Py_DECREF(string); Py_DECREF(string);
if (unlikely(ret < 0)) goto __pyx_err;
} }
sep = PyUnicode_FromString("|"); sep = PyUnicode_FromString("|");
if (sep) if (likely(sep))
signature = PyUnicode_Join(sep, list); signature = PyUnicode_Join(sep, list);
__pyx_err: __pyx_err:
; ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment