-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exc_info
can get lost when throw
ing into an await
or yield from
#108668
Comments
cc @iritkatriel |
GH-84871 may be related. in GH-84871, Footnotes
|
What's the behavior if inner is a function that catches an exception? Did you confirm the bug occurs on all the versions you listed (3.8 and up)? |
Thank you @gschaffner. You say it's impacting "3.8, 3.9, 3.10, 3.11, 3.12, CPython main branch" but later you mention 3.11.5 as the version. Is it impacting all the way back to 3.8? I will look into this (but not treating as urgent for now). |
All four print() statements report RuntimeError.
I confirmed it. The conclusion is that this is a long-standing bug in generators. |
yes. sorry for any confusion! I should have left the |
Bug report
Checklist
and am confident this bug has not been reported before
CPython versions tested on:
3.8, 3.9, 3.10, 3.11, 3.12, CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.11.5 (main, Aug 28 2023, 16:29:45) [GCC 13.2.1 20230801]
A clear and concise description of the bug:
if an exception is active inside a coroutine/generator (
coro1
/agen1
) and another exception is.throw
n into itsawait coro2
/yield from agen2
, thencoro2
/agen2
loses the originalexc_info
.a generator example:
output:
expected output:
same
exc_info
all four times.two coroutine examples (using asyncio in particular, with asyncio calling
throw
):output and expected output: same as the generator example.
this problem is a special case of GH-73773 that was not discussed or fixed as part of that issue1.
for comparison, PyPy behaves the way I expect here.
Footnotes
I am not sure whether it would be preferred that I necrobump the old closed issue or file a new report here. ↩
The text was updated successfully, but these errors were encountered: