Skip to content

Unify multiple-TypeVarTuple error handling - #22216

Open
ilevkivskyi wants to merge 1 commit into
python:masterfrom
ilevkivskyi:fix-double-tvt
Open

ilevkivskyi wants to merge 1 commit into
python:masterfrom
ilevkivskyi:fix-double-tvt

Conversation

@ilevkivskyi

Copy link
Copy Markdown
Member

Fixes #20527

Currently we already have three places where we handle Can only use one type var tuple ..., but as the crash shows, we still didn't cover all cases. I refactored this so that:

  • All such validation is handled by one helper
  • There are just two call sites for it (one for classes, and one for type aliases)
  • Error locations are more robust/consistent

I also slightly changed the error wording and logic so that it is as similar as possible for old vs new syntax, and for classes vs type aliases.

cc @JukkaL

@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

scipy-stubs (https://github.com/scipy/scipy-stubs)
+ tests/misc/test_submodules_empty.pyi:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

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.

Assertion failure crash: assert not self.has_type_var_tuple_type

1 participant