Skip to content

Prevent crash on partial type inferred by a nested expression - #22190

Open
ilevkivskyi wants to merge 1 commit into
python:masterfrom
ilevkivskyi:fix-partial-nested-rvalue
Open

ilevkivskyi wants to merge 1 commit into
python:masterfrom
ilevkivskyi:fix-partial-nested-rvalue

Conversation

@ilevkivskyi

Copy link
Copy Markdown
Member

Fixes #20792

In theory, any nested expression can infer a partial type. Although it is mostly a theoretical thing, it sometimes happens in real life, causing a crash. So it is better to prevent this whole class of crashes by guarding all relevant code paths (btw one of them was already guarded).

cc @JukkaL

@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. ✅

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.

del partial_types[var] fails with KeyError: <Var 'errors' at 0x...>

2 participants