Skip to content

gh-135878: Fix crash in types.SimpleNamespace.__repr__ #135889

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 4 commits into from
Jun 24, 2025

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jun 24, 2025

Note, that there's a small behavior change. We now treat missing keys as errors, because it is the correct thing to do. When ->ns_dict does not have keys from its PyObject_GetIter(keys) - this is strange.

Any suggestions about the test case here are welcome!

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

LGTM. If it's too difficult to come up with a test for this (that isn't the messy fuzzer repro in the issue), I think it's fine to land this without one.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@sobolevn
Copy link
Member Author

Thanks for the good suggestions!

@sobolevn sobolevn merged commit b3ab94a into python:main Jun 24, 2025
40 checks passed
@sobolevn sobolevn added awaiting merge needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jun 24, 2025
@miss-islington-app
Copy link

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 24, 2025
…nGH-135889)

(cherry picked from commit b3ab94a)

Co-authored-by: sobolevn <[email protected]>
Co-authored-by: Peter Bierma <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jun 24, 2025

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 24, 2025
…nGH-135889)

(cherry picked from commit b3ab94a)

Co-authored-by: sobolevn <[email protected]>
Co-authored-by: Peter Bierma <[email protected]>
@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jun 24, 2025
@bedevere-app
Copy link

bedevere-app bot commented Jun 24, 2025

GH-135896 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jun 24, 2025
sobolevn added a commit that referenced this pull request Jun 24, 2025
…35889) (#135896)

gh-135878: Fix crash in `types.SimpleNamespace.__repr__` (GH-135889)
(cherry picked from commit b3ab94a)

Co-authored-by: sobolevn <[email protected]>
Co-authored-by: Peter Bierma <[email protected]>
sobolevn added a commit that referenced this pull request Jun 24, 2025
…35889) (#135895)

gh-135878: Fix crash in `types.SimpleNamespace.__repr__` (GH-135889)
(cherry picked from commit b3ab94a)

Co-authored-by: sobolevn <[email protected]>
Co-authored-by: Peter Bierma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants