Visitar URL original
[3.6] bpo-29655: Fixed possible reference leaks in `import *`. (#301) by berkerpeksag · Pull Request #348 · python/cpython · GitHub
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpo-29655: Fixed possible reference leaks in import *. (#301)
Patch by Matthias Bussonnier.

(cherry picked from commit 160edb4)
  • Loading branch information
Carreau authored and berkerpeksag committed Feb 27, 2017
commit 8215abcfaa13a6e05b2ec7af07364d370e67ff7c
5 changes: 4 additions & 1 deletion Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -2857,13 +2857,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