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

Skip to content

Commit 83969ee

Browse files
committed
Decref all if ensure_fromlist fails. Fixes #876533.
Backported to 2.3.
1 parent 05f842b commit 83969ee

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Python/import.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,9 +2104,10 @@ ensure_fromlist(PyObject *mod, PyObject *fromlist, char *buf, int buflen,
21042104
if (all == NULL)
21052105
PyErr_Clear();
21062106
else {
2107-
if (!ensure_fromlist(mod, all, buf, buflen, 1))
2108-
return 0;
2107+
int ret = ensure_fromlist(mod, all, buf, buflen, 1);
21092108
Py_DECREF(all);
2109+
if (!ret)
2110+
return 0;
21102111
}
21112112
continue;
21122113
}

0 commit comments

Comments
 (0)