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

False positive when using an unpacked typed dict for variadic keyword arguments with a field overlapping a positional only argument #9043

Closed
Viicos opened this issue Sep 20, 2024 · 2 comments
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@Viicos
Copy link

Viicos commented Sep 20, 2024

Code sample in pyright playground

from typing import Any, Unpack, TypedDict


def fine(a: int, /, **kwargs: Any):
    print(a, kwargs)

fine(1, a=2)
#> 1, {'a': 2}

class TD(TypedDict):
    a: int

def bug(a: int, /, **kwargs: Unpack[TD]):
    pass

bug(1, a=2)  # error: Parameter "a" is already assigned
#> 1, {'a': 2}
@Viicos Viicos added the bug Something isn't working label Sep 20, 2024
@erictraut
Copy link
Collaborator

Thanks for the issue.

This has the same root cause as #8964, so fixing one will fix the other.

erictraut added a commit that referenced this issue Sep 23, 2024
… signature contains a positional-only parameter and a keyword parameter with the same name. This can result from the application of a ParamSpec or through the use of an unpacked TypedDict. This addresses #9043 and #8964.
erictraut added a commit that referenced this issue Sep 23, 2024
… signature contains a positional-only parameter and a keyword parameter with the same name. This can result from the application of a ParamSpec or through the use of an unpacked TypedDict. This addresses #9043 and #8964.
erictraut added a commit that referenced this issue Sep 23, 2024
… signature contains a positional-only parameter and a keyword parameter with the same name. This can result from the application of a ParamSpec or through the use of an unpacked TypedDict. This addresses #9043 and #8964. (#9064)
@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Sep 23, 2024
@erictraut
Copy link
Collaborator

This is addressed in pyright 1.1.382.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants