]> granicus.if.org Git - python/commitdiff
Patch number #422106 by Greg Ball, to fix segmentation
authorMoshe Zadka <moshez@math.huji.ac.il>
Mon, 23 Jul 2001 13:32:43 +0000 (13:32 +0000)
committerMoshe Zadka <moshez@math.huji.ac.il>
Mon, 23 Jul 2001 13:32:43 +0000 (13:32 +0000)
fault in sys.displayhook.

Please check this in on the 2.2a1 branch (or whatever is necessary
to get it working next release)

Python/sysmodule.c

index 0d6d5a0f9ff6e9c03e9e8f95009d2ac8dcee0b62..4ae207b3c0c3e4ec37bff1cb108f1b11e3abdbe5 100644 (file)
@@ -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;