Skip to content

[3.15] gh-159739: Allocate thread-local state before constructing the object (GH-160166) - #160286

Merged
JelleZijlstra merged 1 commit into
python:3.15from
miss-islington:backport-4a61673-3.15
Oct 22, 2026
Merged

JelleZijlstra merged 1 commit into
python:3.15from
miss-islington:backport-4a61673-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

If allocating a thread-local object’s internal dictionary or watchdog set fails, a subclass finalizer can run with that state missing. Accessing a thread-local attribute then dereferences the missing state and crashes; allocate both containers before creating the object. Backport to 3.15 and 3.14.
(cherry picked from commit 4a61673)

Co-authored-by: Jelle Zijlstra jelle@openai.com

…object (pythonGH-160166)

If allocating a thread-local object’s internal dictionary or watchdog set fails, a subclass finalizer can run with that state missing. Accessing a thread-local attribute then dereferences the missing state and crashes; allocate both containers before creating the object. Backport to 3.15 and 3.14.
(cherry picked from commit 4a61673)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
@JelleZijlstra
JelleZijlstra enabled auto-merge (squash) October 22, 2026 22:19
@JelleZijlstra
JelleZijlstra merged commit 28dcc8e into python:3.15 Oct 22, 2026
56 checks passed
@miss-islington
miss-islington deleted the backport-4a61673-3.15 branch October 22, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants