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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

(馃悶) (*args: Any) acts inconsistently to how (*args: Any, **kwargs: Any) behaves #16578

Open
KotlinIsland opened this issue Nov 27, 2023 · 0 comments
Labels
bug mypy got something wrong

Comments

@KotlinIsland
Copy link
Contributor

(*args: Any) acts inconsistently to how (*args: Any, **kwargs: Any) behaves:

# mypy: disable-error-code=empty-body
from __future__ import annotations

from typing import Any, Protocol

class Base:
    def f1(self, x: int, *args: Any) -> None: ...
    def f2(self, x: int, *args: Any, **kwargs: Any) -> None: ...

class Derived(Base):
    def f1(self, x: int, y: str) -> None: ...  # Signature of "f1" incompatible with supertype "Base"
    def f2(self, x: int, y: str) -> None: ...

Given that the rest of the arguments after x in Derived.f1 are positional, I would expect this to be a compatible subtype.

@KotlinIsland KotlinIsland added the bug mypy got something wrong label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

1 participant