Skip to content

Commit ac2fff4

Browse files
miss-islingtonMannXoambv
authored
[3.14] gh-140196: Added constructor behavior changes in ast.rst for python 3.13 (GH-140243) (GH-146351)
(cherry picked from commit fae5761) Co-authored-by: Parman Mohammadalizadeh <prmma23@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
1 parent ad273f7 commit ac2fff4

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
@@ -134,6 +134,14 @@ Node classes
134134
Simple indices are represented by their value, extended slices are
135135
represented as tuples.
136136

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

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

0 commit comments

Comments
 (0)