Skip to content

no overload variant of “zip” matches argument error #9048

Closed

Description

@staticdev
  • Are you reporting a bug, or opening a feature request?

Bug.

  • Please insert below the code you are checking with mypy,
    or a mock-up repro if the source is private. We would appreciate
    if you try to simplify your case to a minimal repro.
def bug_repr() -> None:
    ints = [1, 2]
    floats = [3.14, 2.72]
    strings = ['a', 'b']
    for numeric_list in [ints, floats]:
        for number, string in zip(numeric_list, strings):  # <-- error here
            pass
  • What is the actual behavior/output?
error: No overload variant of "zip" matches argument
types "object", "List[Tuple[datetime, timedelta]]"  [call-overload]
                for arg, result in zip(test, results):
                                   ^
note: Possible overload variants:
note:     def [_T1, _T2] zip(*iterables: Tuple[_T1, _T2]) -> Tuple[Tuple[_T
1, ...], Tuple[_T2, ...]]
note:     def [_T1, _T2, _T3] zip(*iterables: Tuple[_T1, _T2, _T3]) -> Tupl
e[Tuple[_T1, ...], Tuple[_T2, ...], Tuple[_T3, ...]]
note:     <3 more similar overloads not shown, out of 10 total overloads>
  • What is the behavior/output you expect?

It should give no error. Please check this: python/typeshed#4254

  • What are the versions of mypy and Python you are using?

v0.782 / 3.8.3

Do you see the same issue after installing mypy from Git master?

Yes.

  • What are the mypy flags you are using?
[mypy]
check_untyped_defs = True
disallow_any_generics = True
disallow_incomplete_defs = True
disallow_subclassing_any = True
disallow_untyped_calls = True
disallow_untyped_decorators = True
disallow_untyped_defs = True
no_implicit_optional = True
no_implicit_reexport = True
pretty = True
show_column_numbers = True
show_error_codes = True
show_error_context = True
strict_equality = True
warn_redundant_casts = True
warn_return_any = True
warn_unreachable = True
warn_unused_configs = True
warn_unused_ignores = True
  • If mypy crashed with a traceback, please paste
    the full traceback below.

See above the errors.

Activity

  1. JelleZijlstra commented on Jun 26, 2020

    @JelleZijlstra
    Member

    This is fixed by reverting the typeshed change, right? The revert will go out with the next mypy release, so I don't think there's anything else for mypy to do here.

  2. staticdev commented on Jun 26, 2020

    @staticdev
    Author
  3. hauntsaninja commented on Jun 26, 2020

    @hauntsaninja
    Collaborator

    This is unrelated to the typeshed change (and unrelated to zip) and is not a regression. The issue is that mypy infers the type of numeric_list to be object, https://mypy-play.net/?mypy=latest&python=3.8&gist=d9e885a7502f7e74d6320095251f6ed2

  4. hauntsaninja commented on Jun 26, 2020

    @hauntsaninja
    Collaborator

    Basically a dupe of #6968

  5. ilevkivskyi commented on Jul 3, 2020

    @ilevkivskyi
    Member

    Basically a dupe of #6968

    Closing as such.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions