Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 35568:8bad1bfc3319 2.4
backport bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Thu, 15 Sep 2005 10:46:18 +0000 |
| parents | 8b07d731be60 |
| children | 214e4a4384f1 |
line wrap: on
line diff
--- a/Python/bltinmodule.c Thu Sep 15 07:29:38 2005 +0000 +++ b/Python/bltinmodule.c Thu Sep 15 10:46:18 2005 +0000 @@ -479,6 +479,13 @@ 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)
