From: Anthony Baxter Date: Wed, 21 Nov 2001 03:51:20 +0000 (+0000) Subject: backport of 2.90: X-Git-Tag: v2.1.2c1~78 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1534ab50b881ac8f8ad6a6fabda8671bfe3e3c00;p=thirdparty%2FPython%2Fcpython.git backport of 2.90: Patch number #422106 by Greg Ball, to fix segmentation fault in sys.displayhook. --- diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 52fbbc89d32d..45b8b3a96cad 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -75,6 +75,11 @@ sys_displayhook(PyObject *self, PyObject *args) PyObject *modules = interp->modules; PyObject *builtins = PyDict_GetItemString(modules, "__builtin__"); + if (builtins == NULL) { + PyErr_SetString(PyExc_RuntimeError, "lost __builtin__"); + return NULL; + } + /* parse arguments */ if (!PyArg_ParseTuple(args, "O:displayhook", &o)) return NULL;