diff Python/sysmodule.c @ 18805:4462c57f6c94 legacy-trunk

Patch number #422106 by Greg Ball, to fix segmentation fault in sys.displayhook. Please check this in on the 2.2a1 branch (or whatever is necessary to get it working next release)
author Moshe Zadka <moshez@math.huji.ac.il>
date Mon, 23 Jul 2001 13:32:43 +0000
parents 064de84385ca
children b9701538f827
line wrap: on
line diff
--- a/Python/sysmodule.c	Mon Jul 23 13:28:37 2001 +0000
+++ b/Python/sysmodule.c	Mon Jul 23 13:32:43 2001 +0000
@@ -75,6 +75,11 @@
 	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;