Skip to content

Commit 565e42f

Browse files
committed
Fix false negatives due to <field>-redefinition symbols in NamedTuples
1 parent d831d78 commit 565e42f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

mypy/stubtest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ def _is_decoratable(stub: nodes.SymbolNode) -> bool:
467467
)
468468
if stub.is_named_tuple:
469469
return all(
470-
name.isidentifier() and not keyword.iskeyword(name) for name in stub.names.keys()
470+
name.isidentifier() and not keyword.iskeyword(name)
471+
for name in stub.metadata["namedtuple"]["fields"]
471472
)
472473
return True
473474

0 commit comments

Comments
 (0)