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

UP044 false positive around PEP 692 TypedDict **kwargs type hints #14047

Closed
kkom opened this issue Nov 1, 2024 · 1 comment · Fixed by #14053
Closed

UP044 false positive around PEP 692 TypedDict **kwargs type hints #14047

kkom opened this issue Nov 1, 2024 · 1 comment · Fixed by #14053
Labels
bug Something isn't working preview Related to preview mode features

Comments

@kkom
Copy link

kkom commented Nov 1, 2024

Since ruff 0.7.2 the code below:

class KwargsDict(TypedDict):
    foo: int
    bar: int

def fun(
    **kwargs: Unpack[KwargsDict],
) -> None: ...

Triggers this error:

UP044 [*] Use `*` for unpacking

I don't think the star syntax is allowed in this case though, see: https://peps.python.org/pep-0692/#introducing-a-new-syntax

And making this change triggers another Ruff error:

SyntaxError: Starred expression cannot be used here Ruff
@MichaReiser
Copy link
Member

Thanks for reporting this and linking to the relevant PEP section. @diceroll123 are you interested in submitting a fix for the new rule?

@MichaReiser MichaReiser added bug Something isn't working rule Implementing or modifying a lint rule preview Related to preview mode features and removed rule Implementing or modifying a lint rule labels Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preview Related to preview mode features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants