Skip to content

"multiple values for keyword argument" with star expansion #6799

Open
@Eugeny

Description

@Eugeny

MyPy seems to be unaware of the length of a Tuple when wrapped in a Union:

from typing import Union, Tuple


def get_tuple() -> Union[Tuple[int, int], Tuple[None, None]]:
    return (1, 2)


def process_tuple(one, two, flag=False):
    print(one, two, flag)


process_tuple(*get_tuple(), flag=True)
1.py:12: error: "process_tuple" gets multiple values for keyword argument "flag"

Same code without a unionized type (def get_tuple() -> Tuple[int, int]:) works.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions