python: Improve general robustness during autocomplete

Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
David Shah 2020-04-24 16:44:30 +01:00
parent 5024fc0690
commit 8f1683246e

View File

@ -94,7 +94,11 @@ const std::list<std::string> &pyinterpreter_suggest(const std::string &hint)
PyObject *py_result;
PyObject *dum;
py_result = Py_CompileString(command.c_str(), "<stdin>", Py_single_input);
if (py_result == nullptr)
break;
dum = PyEval_EvalCode(py_result, glb, loc);
if (dum == nullptr)
break;
Py_XDECREF(dum);
Py_XDECREF(py_result);
res = redirector_take_output(m_threadState);