bpo-32892: Use ast.Constant instead of specific constant AST types. (GH-9445)

diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst
index 9ff422c..97ce2f5 100644
--- a/Doc/library/ast.rst
+++ b/Doc/library/ast.rst
@@ -78,8 +78,8 @@
 
       node = ast.UnaryOp()
       node.op = ast.USub()
-      node.operand = ast.Num()
-      node.operand.n = 5
+      node.operand = ast.Constant()
+      node.operand.value = 5
       node.operand.lineno = 0
       node.operand.col_offset = 0
       node.lineno = 0
@@ -87,9 +87,16 @@
 
    or the more compact ::
 
-      node = ast.UnaryOp(ast.USub(), ast.Num(5, lineno=0, col_offset=0),
+      node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),
                          lineno=0, col_offset=0)
 
+.. deprecated:: 3.8
+
+   Class :class:`ast.Constant` is now used for all constants. Old classes
+   :class:`ast.Num`, :class:`ast.Str`, :class:`ast.Bytes`,
+   :class:`ast.NameConstant` and :class:`ast.Ellipsis` are still available,
+   but they will be removed in future Python releases.
+
 
 .. _abstract-grammar:
 
@@ -239,7 +246,7 @@
           def visit_Name(self, node):
               return copy_location(Subscript(
                   value=Name(id='data', ctx=Load()),
-                  slice=Index(value=Str(s=node.id)),
+                  slice=Index(value=Constant(value=node.id)),
                   ctx=node.ctx
               ), node)