Skip to content

Commit 8888b1a

Browse files
authored
Support typing.Annotated on top of typing_extensions.Annotated (#8371)
This is to handle PEP 593 support recently merged into CPython[1]. [1] python/cpython#18260
1 parent a6c4509 commit 8888b1a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mypy/typeanal.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
'typing.Union',
4444
'typing.Literal',
4545
'typing_extensions.Literal',
46+
'typing.Annotated',
4647
'typing_extensions.Annotated',
4748
} # type: Final
4849

@@ -311,7 +312,7 @@ def try_analyze_special_unbound_type(self, t: UnboundType, fullname: str) -> Opt
311312
return UninhabitedType(is_noreturn=True)
312313
elif fullname in ('typing_extensions.Literal', 'typing.Literal'):
313314
return self.analyze_literal_type(t)
314-
elif fullname == 'typing_extensions.Annotated':
315+
elif fullname in ('typing_extensions.Annotated', 'typing.Annotated'):
315316
if len(t.args) < 2:
316317
self.fail("Annotated[...] must have exactly one type argument"
317318
" and at least one annotation", t)

0 commit comments

Comments
 (0)