Skip to content

Commit fae5761

Browse files
MannXoambv
andauthored
gh-140196: Added constructor behavior changes in ast.rst for python 3.13 (GH-140243)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
1 parent bcff99c commit fae5761

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Doc/library/ast.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ Node classes
131131
Simple indices are represented by their value, extended slices are
132132
represented as tuples.
133133

134+
.. versionchanged:: 3.13
135+
136+
AST node constructors were changed to provide sensible defaults for omitted
137+
fields: optional fields now default to ``None``, list fields default to an
138+
empty list, and fields of type :class:`!ast.expr_context` default to
139+
:class:`Load() <ast.Load>`. Previously, omitted attributes would not exist on constructed
140+
nodes (accessing them raised :exc:`AttributeError`).
141+
134142
.. versionchanged:: 3.14
135143

136144
The :meth:`~object.__repr__` output of :class:`~ast.AST` nodes includes

0 commit comments

Comments
 (0)