Skip to content

[3.15] gh-159739: Keep generic alias arguments alive while formatting errors (GH-159981) - #160020

Merged
JelleZijlstra merged 1 commit into
python:3.15from
miss-islington:backport-9c649db-3.15
Oct 21, 2026
Merged

JelleZijlstra merged 1 commit into
python:3.15from
miss-islington:backport-9c649db-3.15

Conversation

@miss-islington

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

Copy link
Copy Markdown
Contributor

When a generic alias contains a list of parameters and an object claiming to be an unpacked type-variable tuple returns a non-tuple from __typing_subst__, the error path frees the temporary argument tuple before reading it to format a TypeError. That use-after-free can crash the interpreter instead of reporting the invalid substitution.
(cherry picked from commit 9c649db)

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

…errors (pythonGH-159981)

When a generic alias contains a list of parameters and an object claiming to be an unpacked type-variable tuple returns a non-tuple from `__typing_subst__`, the error path frees the temporary argument tuple before reading it to format a `TypeError`. That use-after-free can crash the interpreter instead of reporting the invalid substitution.
(cherry picked from commit 9c649db)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
@JelleZijlstra
JelleZijlstra merged commit 8411879 into python:3.15 Oct 21, 2026
56 checks passed
@miss-islington
miss-islington deleted the backport-9c649db-3.15 branch October 21, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants