Skip to content

Commit fc80096

Browse files
authored
gh-137063: Document that ast node types replaced by Constant are no longer available (#137064)
1 parent cbc0851 commit fc80096

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

Doc/library/ast.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,13 @@ Node classes
139139
The :meth:`~object.__repr__` output of :class:`~ast.AST` nodes includes
140140
the values of the node fields.
141141

142-
.. deprecated:: 3.8
142+
.. deprecated-removed:: 3.8 3.14
143143

144-
Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`,
145-
:class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still available,
146-
but they will be removed in future Python releases. In the meantime,
147-
instantiating them will return an instance of a different class.
144+
Previous versions of Python provided the AST classes :class:`!ast.Num`,
145+
:class:`!ast.Str`, :class:`!ast.Bytes`, :class:`!ast.NameConstant` and
146+
:class:`!ast.Ellipsis`, which were deprecated in Python 3.8. These classes
147+
were removed in Python 3.14, and their functionality has been replaced with
148+
:class:`ast.Constant`.
148149

149150
.. deprecated:: 3.9
150151

@@ -2419,12 +2420,12 @@ and classes for traversing abstract syntax trees:
24192420
during traversal. For this a special visitor exists
24202421
(:class:`NodeTransformer`) that allows modifications.
24212422

2422-
.. deprecated:: 3.8
2423+
.. deprecated-removed:: 3.8 3.14
24232424

24242425
Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`,
2425-
:meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated
2426-
now and will not be called in future Python versions. Add the
2427-
:meth:`visit_Constant` method to handle all constant nodes.
2426+
:meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` will not be called
2427+
in Python 3.14+. Add the :meth:`visit_Constant` method instead to handle
2428+
all constant nodes.
24282429

24292430

24302431
.. class:: NodeTransformer()

0 commit comments

Comments
 (0)