-
Notifications
You must be signed in to change notification settings - Fork 3
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
Python 3.10 support #136
Merged
Python 3.10 support #136
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Avoid range checks on PY_MINOR_VERSION. These get confusing the more that structs diverge across versions. Avoid aliasing struct fields across Python versions too. Instead, when structs/enums/accessors/mutators diverge across Python versions, use an explicit chain of branch contains the full copy of the struct/enum at that version, or the code required to access/mutate a struct field. This should hopefully clear up the code as support for new versions are added, and reduce coding errors over time.
…nor struct _PyInterpreterFrame
achille-roussel
approved these changes
Mar 27, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the refactor into multiple files, so much easier to read and it establishes a good structure to continue maintaining this code for future Python versions 👏
This was referenced Mar 27, 2024
Merged
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for Python 3.10.
Versions prior to 3.11 have an additional stack of "blocks" on each frame that need to be persisted. We now store this information along with a "block pointer" so that we can later restore the frame properly.
In 703f1e8, I changed the extension so that it's more verbose when it comes to handling the differences across Python versions. Previously we were using macros with range checks, and aliasing fields that had the same structure but used different names across versions. Given the divergence in frame structures across Python 3.10 and 3.11, I felt it was better to be explicit and verbose when dealing with differences across versions. There'll now be a block of
#if PY_MINOR_VERSION == N ... #elif PY_MINOR_VERSION == N+1 ... #elif PY_MINOR_VERSION == N+2 ... #endif
each time something changes across versions, and there'll be a block for each version that we support. This should make it easier to add support for more versions (e.g. 3.9) and also deprecate versions in future.This fixes #42.