-
Notifications
You must be signed in to change notification settings - Fork 41
Add support for the free-threaded build of Python 3.14 #83
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0ca6fc8
apply critical sections and declare free-threaded support
ngoldbaum dce1571
add 3.14t CI
ngoldbaum a63918e
fix windows build
ngoldbaum 78246ee
lock gen_id mutation
ngoldbaum 3ffa7a9
Add multithreaded test
ngoldbaum fad0c69
Take ownership of nodes before exiting critical sections
ngoldbaum 66986cc
fix invalid pointer assignment error
ngoldbaum 39ea5a2
bump version
ngoldbaum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ jobs: | |
| - '3.12' | ||
| - '3.13' | ||
| - '3.14' | ||
| - '3.14t' | ||
| - 'pypy3.9' | ||
| - 'pypy3.10' | ||
| steps: | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
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'm less familiar with the python c api than i once was, but i assume incrementing the ref count to
Py_Noneis either a no-op or (since it's None) so meaningless that it's irrelevant.Uh oh!
There was an error while loading. Please reload this page.
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.
That's true, it was only necessary to do that on CPython 3.12 and older. Here's the definition of
Py_RETURN_NONEin the CPython headers:(
Py_NewRefis a variant ofPy_INCREFthat returns the object).There's also an optimization in the implementation of
Py_INCREFitself that skips immortal objects.I restructured the code in this function to always incref (except for NULL return values on errors) because the critical section macros include braces, so it's not syntactically possible to ensure the critical section is closed in an early return block. Instead, all the code paths need to return after the critical section is closed.
IMO it's not worth worrying about optimizing things like avoiding increfs on immortal objects. We should leave it up to CPython to optimize stuff like that and instead aim to make the code as clear and correct as possible.