@@ -2715,13 +2715,14 @@ def check_final(self,
27152715 if is_final_decl and self .scope .active_class ():
27162716 lv = lvs [0 ]
27172717 assert isinstance (lv , RefExpr )
2718- assert isinstance (lv .node , Var )
2719- if (lv .node .final_unset_in_class and not lv .node .final_set_in_init and
2720- not self .is_stub and # It is OK to skip initializer in stub files.
2721- # Avoid extra error messages, if there is no type in Final[...],
2722- # then we already reported the error about missing r.h.s.
2723- isinstance (s , AssignmentStmt ) and s .type is not None ):
2724- self .msg .final_without_value (s )
2718+ if lv .node is not None :
2719+ assert isinstance (lv .node , Var )
2720+ if (lv .node .final_unset_in_class and not lv .node .final_set_in_init and
2721+ not self .is_stub and # It is OK to skip initializer in stub files.
2722+ # Avoid extra error messages, if there is no type in Final[...],
2723+ # then we already reported the error about missing r.h.s.
2724+ isinstance (s , AssignmentStmt ) and s .type is not None ):
2725+ self .msg .final_without_value (s )
27252726 for lv in lvs :
27262727 if isinstance (lv , RefExpr ) and isinstance (lv .node , Var ):
27272728 name = lv .node .name
0 commit comments