Skip to content

Commit

Permalink
bpo-29655: Fixed possible reference leaks in import *. (python#301)
Browse files Browse the repository at this point in the history
Patch by Matthias Bussonnier.
  • Loading branch information
Carreau authored and serhiy-storchaka committed Feb 26, 2017
1 parent 53c1892 commit 160edb4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -2810,13 +2810,16 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
TARGET(IMPORT_STAR) {
PyObject *from = POP(), *locals;
int err;
if (PyFrame_FastToLocalsWithError(f) < 0)
if (PyFrame_FastToLocalsWithError(f) < 0) {
Py_DECREF(from);
goto error;
}

locals = f->f_locals;
if (locals == NULL) {
PyErr_SetString(PyExc_SystemError,
"no locals found during 'import *'");
Py_DECREF(from);
goto error;
}
err = import_all_from(locals, from);
Expand Down

0 comments on commit 160edb4

Please sign in to comment.