This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients benjamin.peterson, gvanrossum, larry, ncoghlan, vstinner, yselivanov
Date 2015-11-12.20:59:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1447361959.0.0.839122121456.issue25612@psf.upfronthosting.co.za>
In-reply-to
Content
Nested try..except statements with yields can loose reference to the current exception.

The following code:

    class MainError(Exception):
        pass

    class SubError(Exception):
        pass

    def main():
        try:
            raise MainError()
        except MainError:
            try:
                yield
            except SubError:
                print('got SubError')
            raise

    coro = main()
    coro.send(None)
    coro.throw(SubError())

prints:

    got SubError
    Traceback (most recent call last):
      File "t.py", line 19, in <module>
        coro.throw(SubError())
      File "t.py", line 15, in main
        raise
    RuntimeError: No active exception to reraise
History
Date User Action Args
2015-11-12 20:59:19yselivanovsetrecipients: + yselivanov, gvanrossum, ncoghlan, vstinner, larry, benjamin.peterson
2015-11-12 20:59:19yselivanovsetmessageid: <1447361959.0.0.839122121456.issue25612@psf.upfronthosting.co.za>
2015-11-12 20:59:18yselivanovlinkissue25612 messages
2015-11-12 20:59:18yselivanovcreate