]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault.
authorGeorg Brandl <georg@python.org>
Thu, 15 Sep 2005 10:46:18 +0000 (10:46 +0000)
committerGeorg Brandl <georg@python.org>
Thu, 15 Sep 2005 10:46:18 +0000 (10:46 +0000)
Python/bltinmodule.c

index 9466ccac623835494d9558de87e394bc815a074b..052ff3c5ed179e65a228f1763fee16626324fd32 100644 (file)
@@ -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)