]> granicus.if.org Git - python/commitdiff
Fixed bugs noted by Greg Stein
authorMoshe Zadka <moshez@math.huji.ac.il>
Thu, 11 Jan 2001 11:55:37 +0000 (11:55 +0000)
committerMoshe Zadka <moshez@math.huji.ac.il>
Thu, 11 Jan 2001 11:55:37 +0000 (11:55 +0000)
* x wasn't initialized to NULL
* Did not DECREF result from displayhook function

Python/ceval.c

index 8012b8357f2eacae7e9e1561bcdc6970221b79b0..347a5411f9368f4c8e8b7cc9fea474c8a42d9736 100644 (file)
@@ -1250,6 +1250,7 @@ eval_code2(PyCodeObject *co, PyObject *globals, PyObject *locals,
                                PyErr_SetString(PyExc_RuntimeError,
                                                "lost sys.displayhook");
                                err = -1;
+                               x = NULL;
                        }
                        if (err == 0) {
                                x = Py_BuildValue("(O)", v);
@@ -1258,6 +1259,7 @@ eval_code2(PyCodeObject *co, PyObject *globals, PyObject *locals,
                        }
                        if (err == 0) {
                                w = PyEval_CallObject(w, x);
+                               Py_XDECREF(w);
                                if (w == NULL)
                                        err = -1;
                        }