diff --git a/mypy/argmap.py b/mypy/argmap.py index 8db78b5413e8..a1c4ef72ea40 100644 --- a/mypy/argmap.py +++ b/mypy/argmap.py @@ -249,10 +249,8 @@ def expand_actual_type( formal_name = (set(actual_type.items.keys()) - self.kwargs_used).pop() self.kwargs_used.add(formal_name) return actual_type.items[formal_name] - elif ( - isinstance(actual_type, Instance) - and len(actual_type.args) > 1 - and is_subtype(actual_type, self.context.mapping_type) + elif isinstance(actual_type, Instance) and is_subtype( + actual_type, self.context.mapping_type ): # Only `Mapping` type can be unpacked with `**`. # Other types will produce an error somewhere else. diff --git a/test-data/unit/check-kwargs.test b/test-data/unit/check-kwargs.test index 3a8c7f5ba454..1418f9c3d184 100644 --- a/test-data/unit/check-kwargs.test +++ b/test-data/unit/check-kwargs.test @@ -345,7 +345,7 @@ from typing import Mapping class MappingSubclass(Mapping[str, str]): pass def f(**kwargs: 'A') -> None: pass d: MappingSubclass -f(**d) +f(**d) # E: Argument 1 to "f" has incompatible type "**MappingSubclass"; expected "A" class A: pass [builtins fixtures/dict.pyi]