-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-111926: Make weakrefs thread-safe in free-threaded builds #117168
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 1 commit
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
9bf3820
Add _PyObject_SetMaybeWeakref
mpage 75603c1
Make PyWeakref_NewRef thread-safe
mpage c4f8453
Make PyWeakref_NewProxy thread-safe
mpage ece230f
Make weakref___new___ thread-safe
mpage 9acae59
Make weakref_hash thread-safe
mpage 6d00f51
Make _PyStaticType_ClearWeakRefs thread-safe
mpage 363a1a6
Handle multiple weakrefs
mpage c9b3bf9
Make _PyWeakref_GetWeakrefCount thread-safe
mpage b7b3315
Make _weakref._getweakrefs thread-safe
mpage e6e2d28
Make weakref clearing in subtype_dealloc thread-safe
mpage 0d259d1
Fix incorrect size in test_sys for weakref/proxy
mpage 7cc523b
Use a once flag
mpage 11be247
Simplify clearing callback-free refs
mpage 8fcd33f
Rationalize naming
mpage 1e1e609
Fix warning
mpage 19a274e
Simplify ClearWeakRefs
mpage 817a5a3
Refactor clearing code
mpage d493e7d
8000
Protect wr_object with a separate mutex
mpage 88078a6
Switch to a sharded lock for linked list and object
mpage dc1f651
Fix formatting
mpage 37c511a
Remove vestigial include
mpage ccaeded
Make sure we set the cleared flag
mpage 6a50381
Use `Py_TryIncref` when returning the ref
mpage d998d1b
Don't leak ref if initialization fails
mpage 37076b5
Remove clinic critical section directives for `_weakref` module
mpage a07d2db
Support async removal of dead weakrefs from WeakValueDictionary
mpage a901848
Only use the striped lock
mpage 8c85fd3
Refactor weakref creation
mpage 0021bc5
Fixups
mpage 40d99d4
Fix formatting
mpage dd922b1
Use QSBR to avoid locking in PyType_IsSubtype
mpage 681872e
Remove unnecessary include
mpage 8982831
Fix unused function warning in default builds
mpage 334c766
Check for callable proxy
mpage 0549445
Refactor weakref creation
mpage eb12c06
Simplify comment
mpage 700cf4c
Get rid of GetWeakrefCountThreadsafe
mpage 63200cd
Don't explicitly zero initialize striped lock
mpage e9eed72
Indent conditional define
mpage e3d5779
Use non-atomic loads while we hold the lock
mpage f31f1e5
Refactor a _PyWeakref_GET_REF and _PyWeakref_IS_DEAD to share more code
mpage b5c9561
Merge helper functions for clearing weakrefs
mpage 93425e6
Make _PyStaticType_ClearWeakRefs have one implementation for default …
mpage 89edf02
Make sure we're able to index into the striped lock even if GC clears us
mpage 7f73480
Consolidate implementations of _PyWeakref_ClearRef and gc_clear
mpage d742ed1
Rename `_Py_TryIncref` to `_Py_TryIncrefCompare`
mpage 37f9ceb
Add `_Py_TryIncref`
mpage fb9eee5
Refactor `weakref._getweakrefs` to have one implementation
mpage d760b99
Refactor to have one implementation for `PyObject_ClearWeakRefs`
mpage 491e4ff
Revert "Use QSBR to avoid locking in PyType_IsSubtype"
mpage 531a076
Accept thread unsafety when checking subtype for now
mpage ed280d8
Update modules to use PyWeakref_GetRef
mpage 2750787
Merge branch 'main' into gh-111926-thread-safe-weakref
mpage 5e7c8bb
Use a pointer to the appropriate mutex rather than a copy of the obje…
mpage 37c9529
Fix formatting
mpage fece88d
Merge implementation of try_reuse_basic_ref
mpage 7a86e35
Remove redundant gc untrack
mpage f89edd1
Update comment
mpage 5a0b976
Add missing braces
mpage 9e67740
Use Py_ssize_t for tracking number of items
8000
mpage 55a211f
Tighten up clearing basic refs/proxies
mpage cdb9290
Simplify _PyStaticType_ClearWeakRefs
mpage c93c336
Simplify get_or_create_weakref
mpage 0366f01
Add _PyWeakref_IsDead
mpage 3e135e4
Remove TODO
mpage dbf7c58
Fix formatting
mpage 73466bf
Update Python/pystate.c
colesbury 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
Switch to a sharded lock for linked list and object
- Loading branch information
commit 88078a686bf0e6ca509d0819289634efdf25da8f
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
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
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
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.
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.
Uh oh!
There was an error while loading. Please reload this page.