Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46872b1

Browse files
committed
Add a missing Py_DECREF to BaseException__unicode__ .
1 parent 5bde08d commit 46872b1

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Python/exceptions.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,22 @@ BaseException__unicode__(PyObject *self, PyObject *args)
285285
}
286286
else if (args_len == 1) {
287287
PyObject *temp = PySequence_GetItem(args, 0);
288+
PyObject *unicode_obj;
289+
288290
if (!temp) {
289291
Py_DECREF(args);
290292
return NULL;
291293
}
292294
Py_DECREF(args);
293-
return PyObject_Unicode(temp);
295+
unicode_obj = PyObject_Unicode(temp);
296+
Py_DECREF(temp);
297+
return unicode_obj;
294298
}
295299
else {
300+
PyObject *unicode_obj = PyObject_Unicode(args);
301+
296302
Py_DECREF(args);
297-
return PyObject_Unicode(args);
303+
return unicode_obj;
298304
}
299305
}
300306
#endif /* Py_USING_UNICODE */

0 commit comments

Comments
 (0)