Skip to content

Commit fe381b2

Browse files
committed
Fix AttributeError in VarAssignVisitor and cleanup test file
Move __class__ assignment check to use self.chk.fail() in VarAssignVisitor, fixing AttributeError. Also remove temporary test comment used for triggering GitHub Actions.
1 parent 523a168 commit fe381b2

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

mypy/checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8882,7 +8882,7 @@ def visit_assignment_stmt(self, s: AssignmentStmt) -> None:
88828882
lv.accept(self)
88838883
if isinstance(lv, MemberExpr):
88848884
if lv.name == '__class__':
8885-
self.fail("Assignment to '__class__' is unsafe and not allowed", lv)
8885+
self.chk.fail("Assignment to '__class__' is unsafe and not allowed", lv)
88868886
self.lvalue = False
88878887

88888888
def visit_name_expr(self, e: NameExpr) -> None:

test-data/unit/check-assign-to-class.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ class E:
2121
def baz(self):
2222
self.x = 2 # OK
2323

24-
# Trigger GitHub Actions for testing

0 commit comments

Comments
 (0)