-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash with TypeVarTuple #15946
Labels
Comments
A bit simplified: from typing import Tuple
from typing_extensions import TypeVarTuple, Unpack
T = TypeVarTuple("T")
class A(Tuple[Unpack[T]]):
...
x: A[str] # errors here |
ilevkivskyi
added a commit
that referenced
this issue
Aug 26, 2023
Fixes #15946 Note this actually adds support also for variadic NamedTuples and variadic TypedDicts. Not that anyone requested this, but since generic NamedTuples and generic TypedDicts are supported using the same mechanism (special aliases) as generic tuple types (like `class A(Tuple[T, S]): ...` in the issue), it looked more risky and arbitrary to _not_support them. Btw the implementation is simple, but while I was working on this, I accidentally found a problem with my general idea of doing certain type normlaizations in `semanal_typeargs.py`. The problem is that sometimes we can call `get_proper_type()` during semantic analysis, so all the code that gets triggered by this (mostly `expand_type()`) can't really rely on types being normalized. Fortunately, with just few tweaks I manged to make the code mostly robust to such scenarios (TBH there are few possible holes left, but this is getting really complex, I think it is better to release this, and see if people will ever hit such scenarios, then fix accordingly).
Opened a new issue that (I think) is linked to the PR that fixes this: this #15978 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Crash Report
Using current dev version of mypy (1.6.0+dev.4077dc6c4b87b273bfd4552d75faaafa6c016c25), with PEP646 experimental flag, the following code makes mypy crash
Traceback
To Reproduce
Your Environment
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: