Skip to content

gh-160682: Track running function objects in free-threaded GC - #160707

Merged
kumaraditya303 merged 3 commits into
python:mainfrom
vankudothuadhinaik:fix-160682-running-function-gc
Oct 26, 2026
Merged

kumaraditya303 merged 3 commits into
python:mainfrom
vankudothuadhinaik:fix-160682-running-function-gc

Conversation

@vankudothuadhinaik

@vankudothuadhinaik vankudothuadhinaik commented Oct 26, 2026 •

Copy link
Copy Markdown

Ensure free-threaded GC accounts for f_funcobj references held by running interpreter frames. Without this, a running method can be collected after its class-dictionary reference is removed.

Add a regression test covering collection during method execution.

Validation on a Py_DEBUG free-threaded build:

  • Focused regression: 1 passed.
  • Free-threaded GC module: 8 passed.
  • Full test_free_threading package: 267 passed, 1 skipped.
  • Focused refleak repetition: passed through six repetitions.
  • make -j2 and git diff --check passed.
  • Native macOS validation was not performed.

Fixes gh-160682.

@bedevere-app

bedevere-app Bot commented Oct 26, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app

bedevere-app Bot commented Oct 26, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@kumaraditya303
kumaraditya303 merged commit b3683c0 into python:main Oct 26, 2026
66 checks passed
@miss-islington-app

Copy link
Copy Markdown

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

@miss-islington-app

Copy link
Copy Markdown

Sorry, @vankudothuadhinaik and @kumaraditya303, I could not cleanly backport this to 3.15 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker b3683c0ffdbed7e055b4b3196775eabae3d6f671 3.15

@miss-islington-app

Copy link
Copy Markdown

Sorry, @vankudothuadhinaik and @kumaraditya303, I could not cleanly backport this to 3.14 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker b3683c0ffdbed7e055b4b3196775eabae3d6f671 3.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

free-threading GC does not properly track references to a running function

2 participants