Commit 78a6c99
committed
Add __class__ assignment check to TypeChecker.visit_assignment_stmt
Implemented the check inside TypeChecker.visit_assignment_stmt to disallow assignments to '__class__', as such assignments are unsafe.
The check correctly uses self.fail() following mypy's error reporting conventions, and is located after initial assignment processing to align with the design of TypeChecker.
Previous redundant logic inside VarAssignVisitor.visit_assignment_stmt has been removed.
This change addresses issue #7724.1 parent cd6d90b commit 78a6c99
1 file changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3077 | 3077 | | |
3078 | 3078 | | |
3079 | 3079 | | |
3080 | | - | |
| 3080 | + | |
| 3081 | + | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
| 3085 | + | |
3081 | 3086 | | |
3082 | 3087 | | |
3083 | 3088 | | |
| |||
8880 | 8885 | | |
8881 | 8886 | | |
8882 | 8887 | | |
8883 | | - | |
8884 | | - | |
8885 | | - | |
8886 | 8888 | | |
8887 | 8889 | | |
8888 | 8890 | | |
| |||
0 commit comments