8000 Fix syntax error in ast Docs example and sync docstring by pablogsal · Pull Request #18946 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Fix syntax error in ast Docs example and sync docstring #18946

New issue 8000

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/ast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions Lib/ast.py
6B2C
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
0