You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behavior of Annotated has been changed so that it is allowed at runtime to wrap ClassVar and Final. This change helps avoid friction with other users of annotations; see https://bugs.python.org/issue46491 for context. This change has landed in 3.11 and has been backported to 3.9, 3.10, and typing_extensions. mypy should follow suit in allowing the wrapping in order to allow the friction lifting to happen in practice.
antest/antest.py:4: error: Invalid type: ClassVar nested inside other typeantest/antest.py:5: error: Final can be only used as an outermost qualifier in a variable annotationFound 2 errors in 1 file (checked 1 source file)
Your Environment
Mypy version used: 0.931
Mypy command-line flags: none
Mypy configuration options from mypy.ini (and other config files): none
No. That is related (but little different) python typing runtime change, while this issue is for type checker change. I'd forgotten about this mypy issue.
Bug Report
The behavior of
Annotated
has been changed so that it is allowed at runtime to wrapClassVar
andFinal
. This change helps avoid friction with other users of annotations; see https://bugs.python.org/issue46491 for context. This change has landed in 3.11 and has been backported to 3.9, 3.10, andtyping_extensions
. mypy should follow suit in allowing the wrapping in order to allow the friction lifting to happen in practice.To Reproduce
Expected Behavior
The above code should type check.
Actual Behavior
Your Environment
mypy.ini
(and other config files): noneAdditional Context
Corresponding issue for dataclasses (incl
InitVar
) is at https://bugs.python.org/issue46511pyright changed at microsoft/pyright@8ce7fa6
pytype issue at google/pytype#1110
pyre issue at facebook/pyre-check#577
The text was updated successfully, but these errors were encountered: