-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
Missing type inference through upper bound of generic type variable leads to error on Unpack in kwargs type hint.
To Reproduce
from typing import TypedDict, Unpack, Any
from abc import abstractmethod
class SomeGeneralOptions(TypedDict):
some_option1: bool
class GenericParentClass[SomeOptions: SomeGeneralOptions]:
def some_wrapper_method(self, val1, val2, **kwargs: Unpack[SomeOptions]) -> Any:
return TrueExpected Behavior
Please correct me if I am wrong, but I think there should be no error due to the upper bound, which ensures that the typevariable is a TypedDict.
Actual Behavior
exampleSimple.py:9: error: Unpack item in ** argument must be a TypedDict [misc]Your Environment
- Mypy version used: 1.19.1
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini(and other config files): None - Python version used:
- MyPy Playground: 3.14
- Local: 3.13.7
As I am only a student and not a professional developer in any way, it would be nice to receive feedback if this actually a MyPy bug, or if I just lack in understanding.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong