Commit 0b2d3508 authored by Stefan Behnel's avatar Stefan Behnel

clean up exec() code a little

parent 5cffd806
...@@ -103,17 +103,17 @@ static PyObject* __Pyx_PyExec3(PyObject* o, PyObject* globals, PyObject* locals) ...@@ -103,17 +103,17 @@ static PyObject* __Pyx_PyExec3(PyObject* o, PyObject* globals, PyObject* locals)
if (!globals) if (!globals)
goto bad; goto bad;
} else if (!PyDict_Check(globals)) { } else if (!PyDict_Check(globals)) {
PyErr_Format(PyExc_TypeError, "exec() arg 2 must be a dict, not %.100s", PyErr_Format(PyExc_TypeError, "exec() arg 2 must be a dict, not %.200s",
globals->ob_type->tp_name); Py_TYPE(globals)->tp_name);
goto bad; goto bad;
} }
if (!locals || locals == Py_None) { if (!locals || locals == Py_None) {
locals = globals; locals = globals;
} }
if (PyDict_GetItemString(globals, "__builtins__") == NULL) { if (PyDict_GetItemString(globals, "__builtins__") == NULL) {
PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins()); if (PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins()) < 0)
goto bad;
} }
if (PyCode_Check(o)) { if (PyCode_Check(o)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment