[3.8] bpo-36917: Add default implementation of ast.NodeVisitor.visit_Constant(). (GH-15490) (GH-15509)
It emits a deprecation warning and calls corresponding method
visit_Num(), visit_Str(), etc.
(cherry picked from commit c3ea41e9bf100a5396b851488c3efe208e5e2179)
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst
index 1e71838..3d2c420 100644
--- a/Doc/library/ast.rst
+++ b/Doc/library/ast.rst
@@ -275,6 +275,13 @@
during traversal. For this a special visitor exists
(:class:`NodeTransformer`) that allows modifications.
+ .. deprecated:: 3.8
+
+ Methods :meth:`visit_Num`, :meth:`visit_Str`, :meth:`visit_Bytes`,
+ :meth:`visit_NameConstant` and :meth:`visit_Ellipsis` are deprecated
+ now and will not be called in future Python versions. Add the
+ :meth:`visit_Constant` method to handle all constant nodes.
+
.. class:: NodeTransformer()