◐ Shell
clean mode source ↗

Message 255039 - Python tracker

Interrogating the thread state like that makes me wonder how this patch behaves in the following scenario:

    class MainError(Exception): pass
    class SubError(Exception): pass

    def yield_coro():
        yield
    coro = yield_coro()
    coro.send(None)

    try:
        raise MainError
    except MainError:
        try:
            coro.throw(SubError)
        except SubError:
            pass
        raise

Also potentially worth exploring is this proposed architectural change from Mark Shannon to move all exception related state out of frame objects: http://bugs.python.org/issue13897

While we couldn't do the latter in a maintenance release, I'd be interested to know what effect it has on this edge case.