Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow to use Final and ClassVar after python 3.13#18358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hauntsaninja merged 9 commits intopython:masterfromaliwo:master
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
9 commits
Select commitHold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
Allow to use Final and ClassVar after python 3.13
  • Loading branch information
@aliwo
aliwo committedDec 29, 2024
commit8885da66306e6f6ac66b36f2ba00fd1b26be2994
2 changes: 1 addition & 1 deletionmypy/semanal.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3657,7 +3657,7 @@ def unwrap_final(self, s: AssignmentStmt) -> bool:
else:
s.type = s.unanalyzed_type.args[0]

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

Expand Down
2 changes: 1 addition & 1 deletiontest-data/unit/check-final.test
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1134,7 +1134,7 @@ class A:
a: Final[ClassVar[int]] # E: Variable should not be annotated with both ClassVar and Final
b: ClassVar[Final[int]] # E: Final can be only used as an outermost qualifier in a variable annotation
c: ClassVar[Final] = 1 # E: Final can be only used as an outermost qualifier in a variable annotation
[out]
[out version<3.13]

[case testFinalClassWithAbstractMethod]
from typing import final
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp