Skip to content

Erroneous 'Too many arguments' error #4997

Closed

Description

@willmcgugan

It appears as though mypy treats argument unpacking as containing at least one element. Here's an example:

from typing import List

class Foo:
    pass

args: List[str] = []
packet = Foo(*args)
tbug.py:7: error: Too many arguments for "Foo"

I guess Mypy is assuming that you would never unpack zero arguments.

In my particular case I have a registry of 'packet classes' and a dynamic number of arguments parsed from the network. Some of those packet classes legitimately have 0 parameters, and Mypy gives me an error about each of them.

Running mypy 0.600 with no other flags.

Activity

  1. added a commit that references this issue on Aug 29, 2019
    8954045
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions