From 1534ab50b881ac8f8ad6a6fabda8671bfe3e3c00 Mon Sep 17 00:00:00 2001 From: Anthony Baxter Date: Wed, 21 Nov 2001 03:51:20 +0000 Subject: [PATCH] backport of 2.90: Patch number #422106 by Greg Ball, to fix segmentation fault in sys.displayhook. --- Python/sysmodule.c | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.47.3