Still have some failing tests in the GIL version so marking as a draft for now until I manage to fix them.
This PR is mostly based on Sam's version: colesbury/nogil-3.12@4ca2924f0d
Since sets have a lot of methods that are exposed, I made this list to keep track and help with the review:
set methods
Method
Thread-safe (comments)
set_add
✅
set_clear
✅
set.__contains__
✅
set_copy
✅
set_discard
✅
set_difference_multi
✅
set_difference_update
✅
set_intersection_multi
✅
set_intersection_update_multi
✅
set_isdisjoint
✅
set_issubset
✅
set_issuperset
✅
set_pop
✅
set.__reduce__
✅
set_remove
✅
set.__sizeof__
✅
set_symmetric_difference
✅
set_symmetric_difference_update
✅
set_union
✅
set_update
✅
set_as_number
Method
Thread-safe (comments)
set_sub
✅
set_and
✅
set_xor
✅ (via set_symmetric_difference)
set_or
✅
set_isub
✅
set_iand
✅
set_ixor
✅
set_ior
✅
set tp_..
Method
Thread-safe (comments)
set_dealloc
Not needed
set_repr
✅
set_as_sequence(set_len, set_contains)
✅
set_traverse
Not needed
set_clear_internal
Not needed
set_richcompare
❌ (will be done separately)
set_iter
✅
set_init
✅
set_new
✅
set_vectorcall
✅
There are also some extra frozenset methods which I don't think need locking: frozenset_copy, frozenset_hash, frozenset_new, frozenset_vectorcall. The rest of frozenset methods are shared with sets.
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.
Still have some failing tests in the GIL version so marking as a draft for now until I manage to fix them.
This PR is mostly based on Sam's version: colesbury/nogil-3.12@4ca2924f0d
Since sets have a lot of methods that are exposed, I made this list to keep track and help with the review:
set methods
set_as_number
set tp_..
There are also some extra frozenset methods which I don't think need locking: frozenset_copy, frozenset_hash, frozenset_new, frozenset_vectorcall. The rest of frozenset methods are shared with sets.
C API methods: