Commit 3f03755
authored
Do not store deferred NamedTuple fields as redefinitions (#20147)
Fixes #17059.
When we encounter a field with a Placeholder as a default, do not record
it in the new symtable as redefinition - it becomes orphan immediately
and remains there, crashing suring serialization.
The test cases are both crashing on current master. Ideally we hould
emit name-defined in all cases, but it is another unrelated issue
(#17610, and likely some others; this is not specific to named tuples -
plain classes also allow referencing variables that are not defined
yet).1 parent 99bc45f commit 3f03755
File tree
2 files changed
+34
-4
lines changed- mypy
- test-data/unit
2 files changed
+34
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
697 | 698 | | |
698 | 699 | | |
699 | 700 | | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
704 | 709 | | |
705 | 710 | | |
706 | 711 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1530 | 1530 | | |
1531 | 1531 | | |
1532 | 1532 | | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
0 commit comments