Skip to content

Commit 661af78

Browse files
committed
Updates to partial_repr
1 parent e53d7e9 commit 661af78

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Modules/_functoolsmodule.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,14 +707,16 @@ partial_repr(PyObject *self)
707707
if (arglist == NULL)
708708
goto done;
709709
/* Pack positional arguments */
710-
assert(PyTuple_Check(pto->args));
711710
args = Py_NewRef(pto->args);
712-
n = PyTuple_GET_SIZE(pto->args);
711+
assert(PyTuple_Check(args));
712+
n = PyTuple_GET_SIZE(args);
713713
for (i = 0; i < n; i++) {
714714
Py_SETREF(arglist, PyUnicode_FromFormat("%U, %R", arglist,
715715
PyTuple_GET_ITEM(args, i)));
716-
if (arglist == NULL)
716+
if (arglist == NULL) {
717+
Py_DECREF(args);
717718
goto done;
719+
}
718720
}
719721
Py_DECREF(args);
720722
/* Pack keyword arguments */

0 commit comments

Comments
 (0)