Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
importcontextlib@contextlib.asynccontextmanagerasyncdeff():try:yieldfinally:passasyncdefamain():asyncwithf():1/0withcontextlib.closing(amain().__await__())asgen:next(gen,None)
Traceback (most recent call last): File "/home/graingert/projects/cpython/demo.py", line 16, in <module> next(gen, None) File "/usr/lib/python3.11/contextlib.py", line 222, in __aexit__ await self.gen.athrow(typ, value, traceback) File "/home/graingert/projects/cpython/demo.py", line 7, in f yield File "/home/graingert/projects/cpython/demo.py", line 12, in amain async with f(): 1/0 ~^~ZeroDivisionError: division by zeroOriginally posted by@graingert in#92118 (comment)
Linked PRs
- gh-95882: fix regression in the traceback of exceptions propagated from inside a contextlib context manager #95883
- [3.10] gh-95882: Add tests for traceback from contextlib context managers (GH-95883) #100715
- [3.11] gh-95882: fix regression in the traceback of exceptions propagated from inside a contextlib context manager (GH-95883) #100718