summaryrefslogtreecommitdiffstats
path: root/Lib/ast.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-03-12 01:06:53 (GMT)
committerGitHub <noreply@github.com>2020-03-12 01:06:53 (GMT)
commit99ef1ac9a7793dcdf624d2400e51ed34eb8d0af3 (patch)
treedee55ca53b1af84250838b28c1fb7a3b480824fe /Lib/ast.py
parent60b1b5ac56fe6099a3d358dc9d6cd6ec72fce2d8 (diff)
downloadcpython-99ef1ac9a7793dcdf624d2400e51ed34eb8d0af3.zip
cpython-99ef1ac9a7793dcdf624d2400e51ed34eb8d0af3.tar.gz
cpython-99ef1ac9a7793dcdf624d2400e51ed34eb8d0af3.tar.bz2
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>
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 b45f1e4..157a833 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -408,11 +408,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=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`