Skip to content

[3.10] gh-93592: Fix frame chain when throwing exceptions into coroutines #95207

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

Merged
merged 2 commits into from
Aug 23, 2022

Conversation

kristjanvalur
Copy link
Contributor

@kristjanvalur kristjanvalur commented Jul 24, 2022

Issue #93592 describes how a coro.throw() will wake up the coroutine, but the frame chain is broken, making it
impossible to get a proper traceback. This impedes debuggers when they break on thrown exceptions, among other things.

The problem is observed in versions 3.7-3.10 but is fixed in 3.11, since there appears to have been structural changes made in frame objects in that version, and the necessary re-write of the generator code seems to have (accidentally?) fixed the issue.

A regression tests is provided, which could also be applied to the 3.11 and main branches.

@kumaraditya303
Copy link
Contributor

Please the PR against main branch and then it will be backported to older branches. Thanks!

@kristjanvalur kristjanvalur changed the title gh-93592: Fix frame chain when throwing exceptions into coroutines [3.10] gh-93592: Fix frame chain when throwing exceptions into coroutines Jul 24, 2022
@kristjanvalur
Copy link
Contributor Author

kristjanvalur commented Jul 24, 2022

@kumaraditya303 PR doesn't apply to main. See above, issue appears to have been accidentally fixed in 3.11, without having been backported.

@kumaraditya303
Copy link
Contributor

kumaraditya303 commented Jul 24, 2022

PR doesn't apply to main. See above, issue appears to have been accidentally fixed in 3.11, without having been backported.

Right, re-opened Sorry for closing your PR, apparently the PR title did not contain [3.10] hence I closed it as we backport changes from main to older branches.

@kumaraditya303
Copy link
Contributor

@kristjanvalur You can add a news entry with https://blurb-it.herokuapp.com/

@kristjanvalur
Copy link
Contributor Author

This has been sitting here for a bit. I wonder if we could request a review from someone else?

@markshannon markshannon merged commit d23ab79 into python:3.10 Aug 23, 2022
@markshannon
Copy link
Member

Thanks @kristjanvalur.

Would you mind porting the regression test to main, to make sure that this stays fixed?

@kristjanvalur
Copy link
Contributor Author

Not at all. I'll create a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants