Bug Report
Please consider the working script below:
from typing import Annotated
T = Annotated[int, 'ops']
if __name__ == '__main__':
print(T.__origin__)
# ^^^^^^^^^^^^^^^^^^^----- error: "type[int]" has no attribute "__origin__" [attr-defined]
print(T.__metadata__)
# ^^^^^^^^^^^^^^^^^^^----- error: "type[int]" has no attribute "__metadata__" [attr-defined]
where mypy generates 2 errors.
(.venv314) PS C:\Users\XXXXXX\YYYYY> mypy --strict tstann.py
tstann.py:7: error: "type[int]" has no attribute "__origin__" [attr-defined]
tstann.py:9: error: "type[int]" has no attribute "__metadata__" [attr-defined]
Found 2 errors in 1 file (checked 1 source file)
Expected Behavior
Absence of these errors
Your Environment
- Mypy version used: 2.1.0 from pypi
- Mypy command-line flags: --strict
- Mypy configuration options from
mypy.ini (and other config files): absent
- Python version used: 3.14.5
- Windows 11
Additionally
These attributes are documented in https://docs.python.org/3/library/typing.html#typing.Annotated
Bug Report
Please consider the working script below:
where mypy generates 2 errors.
Expected Behavior
Absence of these errors
Your Environment
mypy.ini(and other config files): absentAdditionally
These attributes are documented in https://docs.python.org/3/library/typing.html#typing.Annotated