Skip to content

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

Merged
markshannon merged 2 commits into
python:3.10from
kristjanvalur:issue-93592
Aug 23, 2022
Merged

markshannon merged 2 commits into
python:3.10from
kristjanvalur:issue-93592

Conversation

@kristjanvalur

@kristjanvalur kristjanvalur commented Jul 24, 2022 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

kristjanvalur commented Jul 24, 2022 •

Copy link
Copy Markdown
Contributor Author

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

@kumaraditya303

kumaraditya303 commented Jul 24, 2022 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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

@kristjanvalur

Copy link
Copy Markdown
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
Copy Markdown
Member

Thanks @kristjanvalur.

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

@kristjanvalur

Copy link
Copy Markdown
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