Repository navigation
Commit 711a776
committed
gh-135797: Add _field_types to abstract AST classes
Classes without fields never got a _field_types dictionary, so the
attribute was missing on ast.AST and on the abstract classes such as
ast.mod, while typeshed declares it on ast.AST. make_type() now sets an
empty dictionary on every class it creates, and ast.AST gets one too;
add_ast_annotations() keeps filling in the concrete classes.
The constructor relied on the missing attribute to detect user subclasses
that declare _fields but no _field_types, and those must keep working as
before 3.13. An empty dictionary is treated the same way now, otherwise
they would start failing with a missing-field TypeError.1 parent d3ada45 commit 711a776
5 files changed
Lines changed: 98 additions & 16 deletions
File tree
- Doc/library
- Lib/test/test_ast
- Misc/NEWS.d/next/Core_and_Builtins
- Parser
- Python
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
441 | 453 | | |
442 | 454 | | |
443 | 455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1134 | 1134 | | |
1135 | 1135 | | |
1136 | 1136 | | |
1137 | | - | |
1138 | | - | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
1139 | 1142 | | |
1140 | 1143 | | |
| 1144 | + | |
1141 | 1145 | | |
1142 | 1146 | | |
1143 | 1147 | | |
| |||
1690 | 1694 | | |
1691 | 1695 | | |
1692 | 1696 | | |
1693 | | - | |
| 1697 | + | |
1694 | 1698 | | |
1695 | 1699 | | |
1696 | 1700 | | |
| |||
1710 | 1714 | | |
1711 | 1715 | | |
1712 | 1716 | | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
1713 | 1734 | | |
1714 | 1735 | | |
1715 | 1736 | | |
| |||
1839 | 1860 | | |
1840 | 1861 | | |
1841 | 1862 | | |
1842 | | - | |
| 1863 | + | |
1843 | 1864 | | |
1844 | | - | |
1845 | | - | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
1846 | 1875 | | |
1847 | 1876 | | |
1848 | | - | |
| 1877 | + | |
| 1878 | + | |
1849 | 1879 | | |
1850 | 1880 | | |
1851 | 1881 | | |
| 1882 | + | |
1852 | 1883 | | |
1853 | 1884 | | |
1854 | 1885 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments