Skip to content
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

gh-122728: Fix SystemError in PyEval_GetLocals() #122735

Merged
merged 2 commits into from
Aug 6, 2024

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Aug 6, 2024

Fix PyEval_GetLocals() to avoid SystemError ("bad argument to internal function"). Don't redefine the 'ret' variable in the if block.

Add an unit test on PyEval_GetLocals().

Fix PyEval_GetLocals() to avoid SystemError ("bad argument to
internal function"). Don't redefine the 'ret' variable in the if
block.

Add an unit test on PyEval_GetLocals().
@vstinner
Copy link
Member Author

vstinner commented Aug 6, 2024

cc @gaogaotiantian @ncoghlan

@hroncok
Copy link
Contributor

hroncok commented Aug 6, 2024

Will test this in Fedora.

@vstinner
Copy link
Member Author

vstinner commented Aug 6, 2024

Without the Python/ceval.c fix, the unit test reproduces the SystemError bug.

Copy link
Contributor

@hroncok hroncok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change makes sense, is justified in the commit message, and fixes the problem in Fedora.

I have not verified the test fails without the fix, but I trust @vstinner that he has.

The test makes reasonable assertions and calls PyEval_GetLocals.

The news fragment is as detailed as needed.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@Eclips4 Eclips4 added the needs backport to 3.13 bugs and security fixes label Aug 6, 2024
@vstinner vstinner merged commit 4767a6e into python:main Aug 6, 2024
40 checks passed
@vstinner vstinner deleted the get_locals branch August 6, 2024 21:01
@miss-islington-app
Copy link

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 6, 2024
Fix PyEval_GetLocals() to avoid SystemError ("bad argument to
internal function"). Don't redefine the 'ret' variable in the if
block.

Add an unit test on PyEval_GetLocals().
(cherry picked from commit 4767a6e)

Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Aug 6, 2024

GH-122757 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Aug 6, 2024
@thesamesam
Copy link
Contributor

Many thanks for the quick fix and @hroncok for testing it too. Lovely to wake up to :)

vstinner added a commit that referenced this pull request Aug 6, 2024
…122757)

gh-122728: Fix SystemError in PyEval_GetLocals() (GH-122735)

Fix PyEval_GetLocals() to avoid SystemError ("bad argument to
internal function"). Don't redefine the 'ret' variable in the if
block.

Add an unit test on PyEval_GetLocals().
(cherry picked from commit 4767a6e)

Co-authored-by: Victor Stinner <vstinner@python.org>
brandtbucher pushed a commit to brandtbucher/cpython that referenced this pull request Aug 7, 2024
Fix PyEval_GetLocals() to avoid SystemError ("bad argument to
internal function"). Don't redefine the 'ret' variable in the if
block.

Add an unit test on PyEval_GetLocals().
blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
Fix PyEval_GetLocals() to avoid SystemError ("bad argument to
internal function"). Don't redefine the 'ret' variable in the if
block.

Add an unit test on PyEval_GetLocals().
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.

6 participants