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

Skip to content

Commit 7accf20

Browse files
authored
bpo-29655: Fixed possible reference leaks in import *. (#301) (#348)
Patch by Matthias Bussonnier. (cherry picked from commit 160edb4)
1 parent bb59d89 commit 7accf20

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Python/ceval.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -2857,13 +2857,16 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
28572857
TARGET(IMPORT_STAR) {
28582858
PyObject *from = POP(), *locals;
28592859
int err;
2860-
if (PyFrame_FastToLocalsWithError(f) < 0)
2860+
if (PyFrame_FastToLocalsWithError(f) < 0) {
2861+
Py_DECREF(from);
28612862
goto error;
2863+
}
28622864

28632865
locals = f->f_locals;
28642866
if (locals == NULL) {
28652867
PyErr_SetString(PyExc_SystemError,
28662868
"no locals found during 'import *'");
2869+
Py_DECREF(from);
28672870
goto error;
28682871
}
28692872
err = import_all_from(locals, from);

0 commit comments

Comments
 (0)