Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 35567:fa0881fd49b7 legacy-trunk
bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Thu, 15 Sep 2005 10:46:13 +0000 |
| parents | 8fa83a9ebc6e |
| children | a670a5dd1fc6 |
line wrap: on
line diff
--- a/Python/bltinmodule.c Thu Sep 15 02:34:56 2005 +0000 +++ b/Python/bltinmodule.c Thu Sep 15 10:46:13 2005 +0000 @@ -542,6 +542,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)
