Skip to content

Commit 8885da6

Browse files
committed
Allow to use Final and ClassVar after python 3.13
1 parent d79d89e commit 8885da6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mypy/semanal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3657,7 +3657,7 @@ def unwrap_final(self, s: AssignmentStmt) -> bool:
36573657
else:
36583658
s.type = s.unanalyzed_type.args[0]
36593659

3660-
if s.type is not None and self.is_classvar(s.type):
3660+
if s.type is not None and self.options.python_version < (3, 13) and self.is_classvar(s.type):
36613661
self.fail("Variable should not be annotated with both ClassVar and Final", s)
36623662
return False
36633663

test-data/unit/check-final.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ class A:
11341134
a: Final[ClassVar[int]] # E: Variable should not be annotated with both ClassVar and Final
11351135
b: ClassVar[Final[int]] # E: Final can be only used as an outermost qualifier in a variable annotation
11361136
c: ClassVar[Final] = 1 # E: Final can be only used as an outermost qualifier in a variable annotation
1137-
[out]
1137+
[out version<3.13]
11381138

11391139
[case testFinalClassWithAbstractMethod]
11401140
from typing import final

0 commit comments

Comments
 (0)