code_junkie

Why doesn't PyRun_String evaluate bool literals

Nov 14th, 2011
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. PyObject * dict = PyDict_New();
  2. PyObject * val = PyRun_String(expression, Py_eval_input, dict, 0);
  3. Py_DECREF(dict);
  4.  
  5. PyObject* PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals);
  6.  
  7. if (PyDict_GetItemString(globals, "__builtins__") == NULL) {
  8. if (PyDict_SetItemString(globals, "__builtins__",
  9. PyEval_GetBuiltins()) != 0)
  10. return NULL;
  11. }
Add Comment
Please, Sign In to add comment