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 John Belmonte
Recipients John Belmonte, njs
Date 2021-07-09.23:59:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1625875193.61.0.628325060677.issue44594@roundup.psfhosted.org>
In-reply-to
Content
Over at the Trio project, we have evidence that `AsyncExitStack.enter_async_context(foo())` is not actually equivalent to `async with foo()` regarding raised exception context.

The symptom is a very long, unhelpful tracebacks because the __context__ of raised exceptions is not set to the expected object.

https://github.com/python-trio/trio/issues/2001

I can't speak to this solution myself, but njsmith suggests this amendment to contextlib:

    saved_context = exc_details[1].__context__
        try:
            raise exc_details[1]
        finally:
            exc_details[1].__context__ = saved_context
History
Date User Action Args
2021-07-09 23:59:53John Belmontesetrecipients: + John Belmonte, njs
2021-07-09 23:59:53John Belmontesetmessageid: <1625875193.61.0.628325060677.issue44594@roundup.psfhosted.org>
2021-07-09 23:59:53John Belmontelinkissue44594 messages
2021-07-09 23:59:53John Belmontecreate