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 <>
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.

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

    saved_context = exc_details[1].__context__
            raise exc_details[1]
            exc_details[1].__context__ = saved_context
Date User Action Args
2021-07-09 23:59:53John Belmontesetrecipients: + John Belmonte, njs
2021-07-09 23:59:53John Belmontesetmessageid: <>
2021-07-09 23:59:53John Belmontelinkissue44594 messages
2021-07-09 23:59:53John Belmontecreate