We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a96de59 commit fe9ac72Copy full SHA for fe9ac72
mypy/semanal.py
@@ -2128,11 +2128,11 @@ def analyze_namedtuple_assign(self, s: AssignmentStmt) -> bool:
2128
self.is_func_scope())
2129
if not is_named_tuple:
2130
return False
2131
- if isinstance(s.lvalues[0], MemberExpr):
2132
- self.fail("NamedTuple type as an attribute is not supported", s.lvalues[0])
+ if isinstance(lvalue, MemberExpr):
+ self.fail("NamedTuple type as an attribute is not supported", lvalue)
2133
2134
# Yes, it's a valid namedtuple, but defer if it is not ready.
2135
- if not info:
+ if not info and name is not None:
2136
self.mark_incomplete(name, lvalue, becomes_typeinfo=True)
2137
return True
2138
0 commit comments