Skip to content

Unexpected '...' for homogeneous tuples using builtin list, set (PEP 585) #14707

Closed as not planned

Description

@ibondar-altilan

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

Activity

  1. JelleZijlstra commented on Feb 15, 2023

    @JelleZijlstra
    Member

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

  2. ibondar-altilan commented on Feb 16, 2023

    @ibondar-altilan
    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?

  3. erictraut commented on Feb 17, 2023

    @erictraut

    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.

  4. ibondar-altilan commented on Feb 17, 2023

    @ibondar-altilan
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions