]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix syntax error in an example in the ast documentation and sync docstrings (GH-18946)
authorPablo Galindo <Pablogsal@gmail.com>
Thu, 12 Mar 2020 00:48:19 +0000 (00:48 +0000)
committerGitHub <noreply@github.com>
Thu, 12 Mar 2020 00:48:19 +0000 (00:48 +0000)
Doc/library/ast.rst
Lib/ast.py

index 45f16c17d3d38365d650e918d44173005a12cc9d..fc04114949c0c36a1e6e1d84a9881f8d526c140c 100644 (file)
@@ -1704,7 +1704,7 @@ and classes for traversing abstract syntax trees:
                   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`
index 8b88d0fac05ae66a0b27ec0b9c930bf30cfbbb5d..077eb92abb40284d961ce2f2485ec7d36dbe459c 100644 (file)
@@ -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`