Fix syntax error in an example in the ast documentation and sync docstrings (GH-18946)
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst
index 45f16c1..fc04114 100644
--- a/Doc/library/ast.rst
+++ b/Doc/library/ast.rst
@@ -1704,7 +1704,7 @@
value=Name(id='data', ctx=Load()),
slice=Constant(value=node.id),
ctx=node.ctx
- ), node)
+ )
Keep in mind that if the node you're operating on has child nodes you must
either transform the child nodes yourself or call the :meth:`generic_visit`
diff --git a/Lib/ast.py b/Lib/ast.py
index 8b88d0f..077eb92 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -443,11 +443,11 @@
class RewriteName(NodeTransformer):
def visit_Name(self, node):
- return copy_location(Subscript(
+ return Subscript(
value=Name(id='data', ctx=Load()),
slice=Constant(value=node.id),
ctx=node.ctx
- ), node)
+ )
Keep in mind that if the node you're operating on has child nodes you must
either transform the child nodes yourself or call the :meth:`generic_visit`