mirror of
https://github.com/python/cpython.git
synced 2025-09-15 13:16:12 +00:00
bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault.
This commit is contained in:
parent
a783d06f8c
commit
77c85e63b4
1 changed files with 7 additions and 0 deletions
|
@ -542,6 +542,13 @@ builtin_eval(PyObject *self, PyObject *args)
|
||||||
else if (locals == Py_None)
|
else if (locals == Py_None)
|
||||||
locals = globals;
|
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_GetItemString(globals, "__builtins__") == NULL) {
|
||||||
if (PyDict_SetItemString(globals, "__builtins__",
|
if (PyDict_SetItemString(globals, "__builtins__",
|
||||||
PyEval_GetBuiltins()) != 0)
|
PyEval_GetBuiltins()) != 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue