Repository navigation
gh-162618: Remove collected members after WeakSet set operations - #162690
Open
RealBhupesh wants to merge 1 commit into
Open
RealBhupesh wants to merge 1 commit into
RealBhupesh wants to merge 1 commit into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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
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.
Fixes #162618.
WeakSet.intersection_update()can install right-hand weakrefs without removal callbacks.symmetric_difference_update()can stage weakrefs whose temporary referents die before the destination is updated. Both paths can leave dead entries counted bylen()but absent from iteration.Keep selected referents alive until callback-bearing refs are installed:
finally; regression tests cover collection, equal-but-distinct members, temporary iterables, duplicate inputs and subclass return types.Compatibility notes: intersection still selects the right-hand referent for equal iterable members, but now replaces the private
dataset object. XOR toggle order can differ with dictionary staging. Subclasses relying on private backing-set identity and other side-effectful hash/equality behavior beyond the checked cases remain unverified.Validation
On Linux x86-64, fresh CPython 3.16.0a2+dev builds from
572ec16e51c5247db38dce85193d83c11a5d280a:test_httpserversfailed once in a batch whose original failure output was not retained. Its cause is unknown; an isolated rerun passed.make patchcheck, whitespace and patch-applicability checks passed.Limits: default resources only, 15 optional build modules unavailable, Linux only, no debug/refleak or free-threaded build. No suite-wide aggregate test count was retained for the full default-suite batches. Scoped test counts above come from their individual run logs.
AI tools assisted implementation and testing. The patch was checked separately before submission. This is not a claim of personal manual authorship or a claim that every build configuration has passed.