Bug report
A typehint Annotated[T, x] should be interpreted as its type T if not specially handled (see typing documentation).
However, inspect.getmro() fails on Annotated[T, x], while it succeeds on T:
import inspect
import typing
print(inspect.getmro(int))
# works and outputs (<class 'int'>, <class 'object'>)
AnnotatedInt = typing.Annotated[int, 'annotation']
print(inspect.getmro(AnnotatedInt))
# fails with AttributeError: __mro__
I think this is incorrect, and that any remediation more likely should be (generically) in typing.Annotated than (as special case) in inspect.getmro().
Your environment
This fails on all Python version that support Annotated: 3.9-3.11. Tested with 3.9.13, 3.10.4, 3.11.0rc2 on Windows 11.
Linked PRs
Bug report
A typehint
Annotated[T, x]should be interpreted as its typeTif not specially handled (see typing documentation).However,
inspect.getmro()fails onAnnotated[T, x], while it succeeds onT:I think this is incorrect, and that any remediation more likely should be (generically) in
typing.Annotatedthan (as special case) ininspect.getmro().Your environment
This fails on all Python version that support
Annotated: 3.9-3.11. Tested with 3.9.13, 3.10.4, 3.11.0rc2 on Windows 11.Linked PRs
Annotated[int, ...].__mro__access #98234