diff options
author | Georg Brandl <georg@python.org> | 2005-09-15 10:46:13 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2005-09-15 10:46:13 (GMT) |
commit | 77c85e63b42743b22dda5538cedfb1dd1282a657 (patch) | |
tree | b4a01248740b54557f878e8fe9432521d2a9ba79 /Python/bltinmodule.c | |
parent | a783d06f8cb4077dd34567fde418bf6c23073912 (diff) | |
download | cpython-77c85e63b42743b22dda5538cedfb1dd1282a657.zip cpython-77c85e63b42743b22dda5538cedfb1dd1282a657.tar.gz cpython-77c85e63b42743b22dda5538cedfb1dd1282a657.tar.bz2 |
bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 2cadb49..d4e9a22 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) |