diff Python/sysmodule.c @ 21029:ee24bd0cad29 2.1

backport of 2.90: Patch number #422106 by Greg Ball, to fix segmentation fault in sys.displayhook.
author Anthony Baxter <anthonybaxter@gmail.com>
date Wed, 21 Nov 2001 03:51:20 +0000
parents beb9d2b02846
children
line wrap: on
line diff
--- a/Python/sysmodule.c	Mon Nov 19 05:22:44 2001 +0000
+++ b/Python/sysmodule.c	Wed Nov 21 03:51:20 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;