From: Georg Brandl Date: Thu, 15 Sep 2005 10:46:18 +0000 (+0000) Subject: backport bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault. X-Git-Tag: v2.4.2c1~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4aacab4b77392a68d5ff15dac71f093042508346;p=thirdparty%2FPython%2Fcpython.git backport bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault. --- diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 9466ccac6238..052ff3c5ed17 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -479,6 +479,13 @@ builtin_eval(PyObject *self, PyObject *args) else if (locals == Py_None) locals = globals; + if (globals == NULL || locals == NULL) { + PyErr_SetString(PyExc_TypeError, + "eval must be given globals and locals " + "when called without a frame"); + return NULL; + } + if (PyDict_GetItemString(globals, "__builtins__") == NULL) { if (PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins()) != 0)