[Python-ideas] Asynchronous exception handling around with/try statement borders
Chris Angelico
rosuav at gmail.com
Thu Sep 20 18:57:53 EDT 2018
On Fri, Sep 21, 2018 at 8:52 AM Kyle Lahnakoski <klahnakoski at mozilla.com> wrote:
> Since the java.lang.Thread.stop() "debacle", it has been obvious that
> stopping code to run other code has been dangerous. KeyboardInterrupt
> (any interrupt really) is dangerous. Now, we can probably code a
> solution, but how about we remove the danger:
>
> I suggest we remove interrupts from Python, and make them act more like
> java.lang.Thread.interrupt(); setting a thread local bit to indicate an
> interrupt has occurred. Then we can write explicit code to check for
> that bit, and raise an exception in a safe place if we wish. This can
> be done with Python code, or convenient places in Python's C source
> itself. I imagine it would be easier to whitelist where interrupts can
> raise exceptions, rather than blacklisting where they should not.
The time machine strikes again!
https://docs.python.org/3/c-api/exceptions.html#signal-handling
ChrisA
More information about the Python-ideas
mailing list