-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
generator throw delivered to incorrect generator under trace #105162
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
Comments
@markshannon bisected to 411b169 |
It might be related to the fact that Lines 929 to 932 in a99b9d9
...but Lines 910 to 918 in a99b9d9
That seems incorrect. |
This is a little easier for me to follow: def inner():
try:
yield
except Exception:
print("caught by inner")
yield
def outer():
try:
yield from inner()
except Exception:
print("caught by outer")
yield
gen = outer()
gen.send(None)
gen.throw(Exception) brandtbucher@faster-cpython:~/cpython$ ./python bug.py
caught by inner
brandtbucher@faster-cpython:~/cpython$ ./python -m trace -c bug.py
caught by outer |
Will the actual exception in the trace function be thrown away if we simply remove the error check in instrumented version? |
Ignore warnings, fix others and work around python/cpython#105162
No, we would need to explicitly clear it. |
pythonGH-105187) (cherry picked from commit 601ae09) Co-authored-by: Mark Shannon <[email protected]>
Is there anything left to do for this issue? |
Nope! |
Bug report
With the following demo code, a subgenerator
yield from
from a parent generator main(), that catches exceptions and returns "good":when run with
python -m trace
, the exception is delivered to the outer generator main() instead of being suppressedthe problem also occurs with the equivalent generator syntax, eg:
Your environment
see also
urllib3/urllib3#3049 (comment)
nedbat/coveragepy#1635
Linked PRs
INSTRUMENTED_RESUME
in gen.close/throw. #105187INSTRUMENTED_RESUME
in gen.close/throw. (GH-105187) #105378The text was updated successfully, but these errors were encountered: