New type analyzer: confusing error message for broken named tuple
Open
@JukkaL is already working on this.
Since Jun 12, 2019.
bug
priority-1-normal
semantic-analyzer
topic-named-tuple
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
This test case fails:
[case testInvalidNamedTupleBaseClass]
from typing import NamedTuple
defer: Yes
class A(NamedTuple('N', [1])): pass # E: Tuple expected as NamedTuple() field
class Yes: ...
because there is a spurious additional error
main:5: error: Name 'namedtuple@5' already defined on line 5
See also #6422 that may be related (broken named tuples, and named tuples at function scope use similar logic).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.