sbt <[email protected]> added the comment:
> I think calling PyErr_WriteUnraisable would be more appropriate than
> PyErr_Clear.
You mean just adding
PyErr_CheckSignals();
if (PyErr_Occurred())
PyErr_WriteUnraisable(NULL);
before the call to PyFile_WriteString()? That seems to work:
>>> from testsigint import *; wait()
^CException KeyboardInterrupt ignored
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError
> I also wonder whether it's ok to ignore the exception. Pressing e.g.
> Ctrl-C generally shouldn't fail to stop the program, even if another
> exception is being processed at that moment.
The ignoring and clearing of exceptions also happens higher (lower?) in the
call stack in print_exception() and print_exception_recursive(). For example,
print_exception() ends with
/* If an error happened here, don't show it.
XXX This is wrong, but too many callers rely on this behavior. */
if (err != 0)
PyErr_Clear();
}
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13673>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com