]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix syntax error in an example in the ast documentation and sync docstrings (GH-18946)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 12 Mar 2020 01:05:45 +0000 (18:05 -0700)
committerGitHub <noreply@github.com>
Thu, 12 Mar 2020 01:05:45 +0000 (18:05 -0700)
(cherry picked from commit c00c86b90443dbf3534cc4786a0b42b58db6e8af)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Doc/library/ast.rst
Lib/ast.py

index 6d6ae6de78a01f374becc035fbc815e57dde55ff..1dddad8275ac9f114e9ad85f68d8a53e917bdc1b 100644 (file)
@@ -244,7 +244,7 @@ and classes for traversing abstract syntax trees:
                   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`
index 1bc6b38da8d5aefaec1ab220d410952e2dfd630c..818d5638232d32bccc8d0faef629cc1eb78e040a 100644 (file)
@@ -298,11 +298,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`