Skip to content

Fix crash on deferred generic class nested in function#21557

Merged
ilevkivskyi merged 1 commit into
python:masterfrom
ilevkivskyi:fix-nested-class-self-placeholder
May 28, 2026
Merged

Fix crash on deferred generic class nested in function#21557
ilevkivskyi merged 1 commit into
python:masterfrom
ilevkivskyi:fix-nested-class-self-placeholder

Conversation

@ilevkivskyi
Copy link
Copy Markdown
Member

Fixes #21550

Fix is straightforward: do what we do in similar cases elsewhere -- do not store type until it has no placeholders. I am quite sure we don't need to defer in this case, as the only way this can happen is when the enclosing class will call defer() anyway.

@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@ilevkivskyi ilevkivskyi merged commit 5f9371e into python:master May 28, 2026
25 checks passed
@ilevkivskyi ilevkivskyi deleted the fix-nested-class-self-placeholder branch May 28, 2026 23:52
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.

Crash on generic class inside a function with a forward-reference bound

1 participant