summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2005-09-15 10:46:13 (GMT)
committerGeorg Brandl <georg@python.org>2005-09-15 10:46:13 (GMT)
commit77c85e63b42743b22dda5538cedfb1dd1282a657 (patch)
treeb4a01248740b54557f878e8fe9432521d2a9ba79 /Python/bltinmodule.c
parenta783d06f8cb4077dd34567fde418bf6c23073912 (diff)
downloadcpython-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.c7
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)