Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions mypy/argmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/check-kwargs.test
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down