-
-
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
Unexpected '...' for homogeneous tuples using builtin tuple (PEP 585) #9980
Comments
This seems to affect more than just type aliases. When I tried to change the tuples in typeshed's def foo(self) -> tuple[int, ...]: ... # error: Unexpected '...'
def bar(self, x: tuple[int, ...]) -> None: ... # error: Unexpected '...' |
Line 951 in 4827f3a
Maybe this is the problem? |
@srittau Interesting, I noticed it works in some places of our codebase, when I tried isolating them with e.g. That's why I thought this was only happening for type aliases. I'll rename the issue. |
Is this a dup of #10242? Also, are you still seeing these errors? def foo(self) -> tuple[int, ...]: ... # error: Unexpected '...'
def bar(self, x: tuple[int, ...]) -> None: ... # error: Unexpected '...' ☝️ Those don't appear for me in 0.901, but these do: 👇 % cat -n test.py
1 from __future__ import annotations
2
3 from collections.abc import Callable
4
5 _T = tuple[int, ...] # <- spurious `Unexpected "..."` message
6 f: Callable[[_T], None] = lambda t: print("{}".format(t))
7 f((1, 2, 3))
8 f([1, 2, 3]) # <- still validly caught, apparently
% mypy test.py
test.py:5: error: Unexpected "..."
test.py:8: error: Argument 1 has incompatible type "List[int]"; expected "Tuple[int, ...]"
Found 2 errors in 1 file (checked 1 source file)
% python --version
Python 3.9.5
% mypy --version
mypy 0.901 |
This is still happening to me on 0.910. Here is a snippet: T = tuple[int, ...] Here are the mypy version check and output:
|
I think the fix was landed after 0.910 was released. @JukkaL, can you confirm whether it will make it into the next one? |
@JukkaL any update on when this will be released ? |
Furthermore, any plans on releasing this fix before Python 4? |
You can follow #11158 for the release. I can promise you that this will be released before Python 4 :D |
Bug Report
When using builtin tuple to create a type alias, mypy reports an error.
To Reproduce
Expected Behavior
No error.
Actual Behavior
Your Environment
Mypy version used: 0.800
Mypy command-line flags:
Mypy configuration options from
mypy.ini
(and other config files):Python version used: 3.9.0
Operating system and version: Macos 11.1
The text was updated successfully, but these errors were encountered: