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

Skip to content

Commit f5df383

Browse files
author
Moshe Zadka
committed
Fixed bugs noted by Greg Stein
* x wasn't initialized to NULL * Did not DECREF result from displayhook function
1 parent ab78bec commit f5df383

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Python/ceval.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,7 @@ eval_code2(PyCodeObject *co, PyObject *globals, PyObject *locals,
12501250
PyErr_SetString(PyExc_RuntimeError,
12511251
"lost sys.displayhook");
12521252
err = -1;
1253+
x = NULL;
12531254
}
12541255
if (err == 0) {
12551256
x = Py_BuildValue("(O)", v);
@@ -1258,6 +1259,7 @@ eval_code2(PyCodeObject *co, PyObject *globals, PyObject *locals,
12581259
}
12591260
if (err == 0) {
12601261
w = PyEval_CallObject(w, x);
1262+
Py_XDECREF(w);
12611263
if (w == NULL)
12621264
err = -1;
12631265
}

0 commit comments

Comments
 (0)