Skip to content
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 '...' in standard tuple #9459

Closed
frost-nzcr4 opened this issue Sep 18, 2020 · 4 comments
Closed

Unexpected '...' in standard tuple #9459

frost-nzcr4 opened this issue Sep 18, 2020 · 4 comments
Labels
bug mypy got something wrong

Comments

@frost-nzcr4
Copy link

frost-nzcr4 commented Sep 18, 2020

Bug Report

To Reproduce

from __future__ import annotations

from typing import Tuple


# Standard tuple
tuple_1: tuple[str, str, str] = ("b", "c", "d")
# error: Unexpected '...'  [misc]
tuple_2_err: tuple[str, ...] = ("b", "c")
# error: Unexpected '...'  [misc]
# error: Dict entry 0 has incompatible type "str": "Tuple[str, str, str]"; expected "str": "Tuple[str, Any]"  [dict-item]
tuple_3_err: tuple[str, ...] = ("b", "c", "d")

dict_with_tuple_1: dict[str, tuple[str, str, str]] = {"a": ("b", "c", "d")}
# error: Unexpected '...'  [misc]
dict_with_tuple_2_err: dict[str, tuple[str, ...]] = {"a": ("b", "c")}
# error: Unexpected '...'  [misc]
# error: Dict entry 0 has incompatible type "str": "Tuple[str, str, str]"; expected "str": "Tuple[str, Any]"  [dict-item]
dict_with_tuple_3_err: dict[str, tuple[str, ...]] = {"a": ("b", "c", "d")}

# typing.Tuple
tuple_10: Tuple[str, str, str] = ("b", "c", "d")
tuple_20: Tuple[str, ...] = ("b", "c")
tuple_30: Tuple[str, ...] = ("b", "c", "d")

dict_with_tuple_10: dict[str, Tuple[str, str, str]] = {"a": ("b", "c", "d")}
dict_with_tuple_20: dict[str, Tuple[str, ...]] = {"a": ("b", "c")}
dict_with_tuple_30: dict[str, Tuple[str, ...]] = {"a": ("b", "c", "d")}

Expected Behavior

I've expected that tuple and typing.Tuple works the same and errors will not occurs.

Actual Behavior

Standard tuple have got error: Unexpected '...' [misc]

Your Environment

  • Mypy version used: 0.790+dev.44a96876c9f2303af8258532f99cd821a98112dc
  • Mypy command-line flags: --ignore-missing-imports --show-error-codes
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: Python 3.9.0rc2
  • Operating system and version: docker FROM python:3.9-rc-buster
@frost-nzcr4 frost-nzcr4 added the bug mypy got something wrong label Sep 18, 2020
@hauntsaninja
Copy link
Collaborator

Dupe of #7907

@Jasha10
Copy link

Jasha10 commented Nov 8, 2021

The linked issue #7907 reports that this issue was solved by PR #9564, but I find that this is still an issue in mypy version 0.910:

from typing import Tuple
ex1: Tuple[int, ...]  # ok
ex2 = Tuple[int, ...]  # ok
ex3: tuple[int, ...]  # ok
ex4 = tuple[int, ...]  # error: Unexpected "..."

Should we reopen this issue? Or should I file a new one?

@hauntsaninja
Copy link
Collaborator

This has been fixed on master for a long time, try pip install -U git+git://github.com/python/mypy.git.

This issue tracks the 0.920 release: #11158
Unfortunately, the people with the ability to push the release over the line have been really busy.

@ShahriyarR
Copy link

ShahriyarR commented Nov 24, 2021

Same issue with Callable[[], ...] the result error: Unexpected "..."

$ mypy --version
mypy 0.920+dev.b47245adc60eecde9164799c426f3bffcedbc48e

$ python3 --version
Python 3.9.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

4 participants