Skip to content

Commit fe9ac72

Browse files
committed
Explicitly check name to be not None
1 parent a96de59 commit fe9ac72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mypy/semanal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,11 +2128,11 @@ def analyze_namedtuple_assign(self, s: AssignmentStmt) -> bool:
21282128
self.is_func_scope())
21292129
if not is_named_tuple:
21302130
return False
2131-
if isinstance(s.lvalues[0], MemberExpr):
2132-
self.fail("NamedTuple type as an attribute is not supported", s.lvalues[0])
2131+
if isinstance(lvalue, MemberExpr):
2132+
self.fail("NamedTuple type as an attribute is not supported", lvalue)
21332133
return False
21342134
# Yes, it's a valid namedtuple, but defer if it is not ready.
2135-
if not info:
2135+
if not info and name is not None:
21362136
self.mark_incomplete(name, lvalue, becomes_typeinfo=True)
21372137
return True
21382138

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy