Skip to content

Commit 80c1b38

Browse files
committed
Sync with python#4072
1 parent 424334a commit 80c1b38

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mypy/checker.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2886,7 +2886,10 @@ def builtin_item_type(tp: Type) -> Optional[Type]:
28862886
return join_type_list(tp.items)
28872887
elif isinstance(tp, TypedDictType) and tp.fallback.type.fullname() == 'typing.Mapping':
28882888
# TypedDict always has non-optional string keys.
2889-
return tp.fallback.args[0]
2889+
if tp.fallback.type.fullname() == 'typing.Mapping':
2890+
return tp.fallback.args[0]
2891+
elif tp.fallback.type.bases[0].type.fullname() == 'typing.Mapping':
2892+
return tp.fallback.type.bases[0].args[0]
28902893
return None
28912894

28922895

0 commit comments

Comments
 (0)