Skip to content

gh-112358: Fix Python 3.12 regression with subclassing struct.Struct. #112424

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 3 commits into from
Nov 26, 2023

Conversation

mdickinson
Copy link
Member

@mdickinson mdickinson commented Nov 26, 2023

This PR reverts commit c8c0afc (PR #94532), which caused issues with code in the wild that subclasses struct.Struct.

Note for reviewers: the first commit contains no manual changes: it's the result of a git revert c8c0afc followed by python Tools/clinic/clinic.py -f Modules/_struct.c to regenerate the argument clinic code.

@mdickinson
Copy link
Member Author

@AlexWaygood Thanks for alerting me to this issue. Would you be willing to review the fix?

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

I'm generally not the person you'd want to review a change to C code, but this looks like a clean revert, so I'm confident in approving this. Thanks!

@mdickinson
Copy link
Member Author

I'm generally not the person you'd want to review a change to C code

Okay, noted for the future. :-)

this looks like a clean revert

Ah yes, I should have elaborated in the PR description (and I've belatedly updated the PR description): the first commit is indeed a clean revert (git revert), modulo a forced regeneration of the argument clinic code.

Thank you for reviewing!

@mdickinson mdickinson merged commit 9fe6034 into python:main Nov 26, 2023
@miss-islington-app
Copy link

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

@miss-islington-app
Copy link

Sorry, @mdickinson, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 9fe60340d7e8dc22b3aec205c557bc69a1b2d18c 3.12

@bedevere-app
Copy link

bedevere-app bot commented Nov 26, 2023

GH-112426 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Nov 26, 2023
mdickinson added a commit to mdickinson/cpython that referenced this pull request Nov 26, 2023
…truct.Struct. (pythonGH-112424)

Revert commit c8c0afc (PR pythonGH-94532),
which moved `struct.Struct` initialisation from `Struct.__init__` to `Struct.__new__`.
This caused issues with code in the wild that subclasses `struct.Struct`..
(cherry picked from commit 9fe6034)

Co-authored-by: Mark Dickinson <[email protected]>
mdickinson added a commit that referenced this pull request Nov 27, 2023
…Struct (GH-112424) (#112426)

* [3.12] gh-112358: Fix Python 3.12 regression with subclassing struct.Struct. (GH-112424)

Revert commit c8c0afc (PR GH-94532),
which moved `struct.Struct` initialisation from `Struct.__init__` to `Struct.__new__`.
This caused issues with code in the wild that subclasses `struct.Struct`..
(cherry picked from commit 9fe6034)

Co-authored-by: Mark Dickinson <[email protected]>

* Remove unrelated test
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…truct. (python#112424)

Revert commit c8c0afc (PR python#94532),
which moved `struct.Struct` initialisation from `Struct.__init__` to `Struct.__new__`.
This caused issues with code in the wild that subclasses `struct.Struct`.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…truct. (python#112424)

Revert commit c8c0afc (PR python#94532),
which moved `struct.Struct` initialisation from `Struct.__init__` to `Struct.__new__`.
This caused issues with code in the wild that subclasses `struct.Struct`.
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.

2 participants