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 '...' for homogeneous tuples using builtin list, set (PEP 585) #14707

Closed
ibondar-altilan opened this issue Feb 15, 2023 · 4 comments
Closed
Labels
bug mypy got something wrong

Comments

@ibondar-altilan
Copy link

Bug Report

The same error for tuple was fixed in #10766 but I see now an error "Unexpected" for the builtin types list, set:

To Reproduce

# the snippet
l = list[str, ...]  # error

t = tuple[str, ...]  # no error

s = set[str, ...]  # error

Expected Behavior
No errors

Actual Behavior
test.py:1: error: Unexpected "..." [misc]
test.py:1: error: "list" expects 1 type argument, but 2 given [type-arg]
test.py:5: error: Unexpected "..." [misc]
test.py:5: error: "set" expects 1 type argument, but 2 given [type-arg]
Found 4 errors in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: 1.0.0
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): default after installation
  • Python version used: 3.10.5
@ibondar-altilan ibondar-altilan added the bug mypy got something wrong label Feb 15, 2023
@JelleZijlstra
Copy link
Member

This is correct. tuple is special; ... is invalid for other types (other than Callable, where it has a different specialized meaning).

@JelleZijlstra JelleZijlstra closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2023
@ibondar-altilan
Copy link
Author

Thank you. But the built-in PyCharm linter handles all these types in the same way. Tuple is special for mypy only or it is written in PEP 585?

@erictraut
Copy link

PEP 484 specifies the behavior of Tuple. The ... is not allowed in the other type annotations above. It sounds like PyCharm is not in compliance with the typing spec.

@ibondar-altilan
Copy link
Author

Yes, I've got that, thanks

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

3 participants