summaryrefslogtreecommitdiffstats
path: root/Lib/ast.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-03-12 00:48:19 (GMT)
committerGitHub <noreply@github.com>2020-03-12 00:48:19 (GMT)
commitc00c86b90443dbf3534cc4786a0b42b58db6e8af (patch)
treeab52af8faa5b0a0de6b8629ddeaf4ca2507186a5 /Lib/ast.py
parent276a84a0a6c694ce227bf36ec2e2e6ec6686170f (diff)
downloadcpython-c00c86b90443dbf3534cc4786a0b42b58db6e8af.zip
cpython-c00c86b90443dbf3534cc4786a0b42b58db6e8af.tar.gz
cpython-c00c86b90443dbf3534cc4786a0b42b58db6e8af.tar.bz2
Fix syntax error in an example in the ast documentation and sync docstrings (GH-18946)
Diffstat (limited to 'Lib/ast.py')
-rw-r--r--Lib/ast.py4
1 files changed, 2 insertions, 2 deletions
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 NodeTransformer(NodeVisitor):
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`