diff options
author | Georg Brandl <georg@python.org> | 2005-09-15 10:46:18 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2005-09-15 10:46:18 (GMT) |
commit | 4aacab4b77392a68d5ff15dac71f093042508346 (patch) | |
tree | f0bcd987dc16ce16ecae441dfd19eee794e06888 | |
parent | 1e2be08761414ff498d88c3e9eebb91677715807 (diff) | |
download | cpython-4aacab4b77392a68d5ff15dac71f093042508346.zip cpython-4aacab4b77392a68d5ff15dac71f093042508346.tar.gz cpython-4aacab4b77392a68d5ff15dac71f093042508346.tar.bz2 |
backport bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault.
-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 9466cca..052ff3c 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) |