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

index 2cadb49cfeed8016cc23ce650bbe3bbd6bf7d7ee..d4e9a22e5f4391cd4d4bb59722ffde88405159c3 100644 (file)
@@ -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)