Skip to content

gh-152235: Defer GC tracking in set.union and set.difference#152290

Merged
corona10 merged 2 commits into
python:mainfrom
corona10:gh-152235-union-diffrence
Jun 26, 2026
Merged

gh-152235: Defer GC tracking in set.union and set.difference#152290
corona10 merged 2 commits into
python:mainfrom
corona10:gh-152235-union-diffrence

Conversation

@corona10

@corona10 corona10 commented Jun 26, 2026

Copy link
Copy Markdown
Member

@corona10 corona10 requested a review from vstinner June 26, 2026 14:11
@corona10 corona10 requested a review from rhettinger as a code owner June 26, 2026 14:11
@corona10 corona10 added topic-free-threading needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 26, 2026
@corona10 corona10 force-pushed the gh-152235-union-diffrence branch from 3bbef7e to 18edd99 Compare June 26, 2026 14:11

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread Objects/setobject.c
PyObject *result;

result = set_copy_impl(so);
result = set_copy_untracked_lock_held(so);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may rename set_copy_and_difference() to set_copy_and_difference_untracked(), and rename set_difference() to set_difference_untracked().

@@ -0,0 +1,2 @@
Defer GC tracking in :meth:`set.union`, :meth:`set.difference` and
:meth:`set.__sub__`. Patch by Donghee Na.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may complete the Changelog entry of your previous PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the Docs/Docs CI doesn't like set.__sub__ reference:

/home/runner/work/cpython/cpython/Doc/build/NEWS:854: WARNING: py:meth reference target not found: set.__sub__ [ref.meth]

@corona10 corona10 enabled auto-merge (squash) June 26, 2026 16:46
@corona10 corona10 merged commit 5a549e8 into python:main Jun 26, 2026
54 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington-app

Copy link
Copy Markdown

Sorry, @corona10, I could not cleanly backport this to 3.15 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 5a549e82b81378cb294904dab49cbee853bddd64 3.15

@miss-islington-app

Copy link
Copy Markdown

Sorry, @corona10, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 5a549e82b81378cb294904dab49cbee853bddd64 3.13

@bedevere-app

bedevere-app Bot commented Jun 26, 2026

Copy link
Copy Markdown

GH-152312 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 26, 2026
@bedevere-app

bedevere-app Bot commented Jun 26, 2026

Copy link
Copy Markdown

GH-152316 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 26, 2026
@corona10 corona10 deleted the gh-152235-union-diffrence branch June 26, 2026 17:25
@bedevere-app

bedevere-app Bot commented Jun 26, 2026

Copy link
Copy Markdown

GH-152319 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jun 26, 2026
corona10 added a commit that referenced this pull request Jun 26, 2026
…h-152290) (gh-152312)

gh-152235: Defer GC tracking in set.union and set.difference (gh-152290)
(cherry picked from commit 5a549e8)

Co-authored-by: Donghee Na <donghee.na@python.org>
corona10 added a commit that referenced this pull request Jun 26, 2026
corona10 added a commit that referenced this pull request Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants