Skip to content

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

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

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

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 merged commit 2d358c6 into python:3.14 Oct 22, 2026
51 checks passed
@miss-islington
miss-islington deleted the backport-4a61673-3.14 branch October 22, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants