From: Georg Brandl Date: Thu, 15 Sep 2005 10:46:13 +0000 (+0000) Subject: bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault. X-Git-Tag: v2.5a0~1374 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77c85e63b42743b22dda5538cedfb1dd1282a657;p=thirdparty%2FPython%2Fcpython.git bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault. --- diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 2cadb49cfeed..d4e9a22e5f43 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -542,6 +542,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)