Closed
Description
Bug Report
Came across this override error while testing **kwargs
unpack from #13471.
/CC: @ilevkivskyi
To Reproduce
from typing import Any, TypedDict
from typing_extensions import Unpack
class Details(TypedDict, total=False):
arg: str
value: int
class Parent:
def turn_on(self, **kwargs: Any) -> None: ...
class Child(Parent):
def turn_on(self, **kwargs: Unpack[Details]) -> None: ... # <-- error
Expected Behavior
The parent methods uses Any
as annotation for **kwargs
. Any override with Upack[_TypedDict_]
should be compatible.
Actual Behavior
test.py:13: error: Signature of "turn_on" incompatible with supertype "Parent" [override]
test.py:13: note: Superclass:
test.py:13: note: def turn_on(self, **kwargs: Any) -> None
test.py:13: note: Subclass:
test.py:13: note: def turn_on(*, arg: str = ..., value: int = ...) -> None
Your Environment
- Mypy version used: mypy
0.980+dev.0c0f071ef5d41c24182a5a94a5db882f9e917802 (compiled: no)
- Mypy command-line flags:
--enable-incomplete-features
- Python version used:
3.10