Apr-18-2019, 03:57 PM
I have embedded Python (currently 2.7.16).
After using Py_CompileString() to build user-entered Python code and then checking for errors, I use PyEval_EvalCode() to execute the resulting PyObject *.
My question: Is there a way to know from the interpreter after calling PyEval_EvalCode() that it is expecting more input? I've looked through the API, and I don't seen anything immediately apparent.
I'm currently coding that for myself, the heuristics being the interpreter needs more input if the line ends with a colon, or the current input has unbalanced parentheses ("("), brackets ("["), braces ("{") or strings.
Thanks in advance for any insights.
After using Py_CompileString() to build user-entered Python code and then checking for errors, I use PyEval_EvalCode() to execute the resulting PyObject *.
My question: Is there a way to know from the interpreter after calling PyEval_EvalCode() that it is expecting more input? I've looked through the API, and I don't seen anything immediately apparent.
I'm currently coding that for myself, the heuristics being the interpreter needs more input if the line ends with a colon, or the current input has unbalanced parentheses ("("), brackets ("["), braces ("{") or strings.
Thanks in advance for any insights.
