Skip to content

Commit 0dadf56

Browse files
authored
bpo-29655: Fixed possible reference leaks in import *. (#301) (#349)
Patch by Matthias Bussonnier. (cherry picked from commit 160edb4)
1 parent bc144f0 commit 0dadf56

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Python/ceval.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2832,13 +2832,16 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
28322832
TARGET(IMPORT_STAR) {
28332833
PyObject *from = POP(), *locals;
28342834
int err;
2835-
if (PyFrame_FastToLocalsWithError(f) < 0)
2835+
if (PyFrame_FastToLocalsWithError(f) < 0) {
2836+
Py_DECREF(from);
28362837
goto error;
2838+
}
28372839

28382840
locals = f->f_locals;
28392841
if (locals == NULL) {
28402842
PyErr_SetString(PyExc_SystemError,
28412843
"no locals found during 'import *'");
2844+
Py_DECREF(from);
28422845
goto error;
28432846
}
28442847
READ_TIMESTAMP(intr0);

0 commit comments

Comments
 (0)