Skip to content

gh-159739: Clear free-threaded GC worklists after early errors - #159979

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-gc-early-error-worklists
Oct 21, 2026
Merged

JelleZijlstra merged 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-gc-early-error-worklists

Conversation

@jelle-openai

@jelle-openai jelle-openai commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Clear free-threaded GC worklists after early errors. On a free-threaded build, an allocation failure while marking roots or identifying unreachable objects can abort a collection after its worklists have acquired strong references. The early return abandons those references and their GC bookkeeping, so the affected objects remain alive and memory is leaked.

Backport to 3.15 and 3.14.

@corona10
corona10 requested review from DinoV and nascheme October 20, 2026 23:23
@JelleZijlstra JelleZijlstra added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 20, 2026
@JelleZijlstra
JelleZijlstra merged commit 2315d94 into python:main Oct 21, 2026
62 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @jelle-openai for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 21, 2026
@bedevere-app

bedevere-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

GH-160017 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 Oct 21, 2026
JelleZijlstra pushed a commit that referenced this pull request Oct 21, 2026
…GH-159979) (#160017)

(cherry picked from commit 2315d94)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
JelleZijlstra pushed a commit that referenced this pull request Oct 21, 2026
…GH-159979) (#160016)

(cherry picked from commit 2315d94)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants