Catch and reset KeyboardInterrupt after py_input read() call.

parent 805ca9d3
...@@ -163,7 +163,17 @@ void py_input(PyObject *parser, char *buf, int *result, int max_size) ...@@ -163,7 +163,17 @@ void py_input(PyObject *parser, char *buf, int *result, int max_size)
Py_DECREF(handle); Py_DECREF(handle);
Py_DECREF(arglist); Py_DECREF(arglist);
if (unlikely(!res)) { return; } if (unlikely(!res)) {
// Catch and reset KeyboardInterrupt exception
PyObject *given = PyErr_Occurred();
if (given && PyErr_GivenExceptionMatches(given,
PyExc_KeyboardInterrupt)) {
PyErr_Clear();
}
return;
}
// Check if the "hook_read_after" callback exists // Check if the "hook_read_after" callback exists
if (unlikely(!PyObject_HasAttr(parser, py_attr_hook_read_after_name))) if (unlikely(!PyObject_HasAttr(parser, py_attr_hook_read_after_name)))
......
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