Fix syntax error in an example in the ast documentation and sync docstrings (GH-18946)
(cherry picked from commit c00c86b90443dbf3534cc4786a0b42b58db6e8af)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
diff --git a/Lib/ast.py b/Lib/ast.py
index b45f1e4..157a833 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -408,11 +408,11 @@
class RewriteName(NodeTransformer):
def visit_Name(self, node):
- return copy_location(Subscript(
+ return Subscript(
value=Name(id='data', ctx=Load()),
slice=Index(value=Str(s=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`