summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerry Reedy <tjreedy@udel.edu>2011-01-24 21:36:03 (GMT)
committerTerry Reedy <tjreedy@udel.edu>2011-01-24 21:36:03 (GMT)
commitfeac624827a6523e29f69210d69a0627d19bfd2b (patch)
tree3f5a72d4c04feaaa835e9d3edc63d0a7685d1ffa
parentb02701101b94bda88179652b0133557baa801368 (diff)
downloadcpython-feac624827a6523e29f69210d69a0627d19bfd2b.zip
cpython-feac624827a6523e29f69210d69a0627d19bfd2b.tar.gz
cpython-feac624827a6523e29f69210d69a0627d19bfd2b.tar.bz2
Issue #11000 ast.parse parses source, not just expressions.
-rw-r--r--Doc/library/ast.rst4
-rw-r--r--Lib/ast.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst
index ca8af56..e2c0b6d 100644
--- a/Doc/library/ast.rst
+++ b/Doc/library/ast.rst
@@ -110,9 +110,9 @@ The abstract grammar is currently defined as follows:
Apart from the node classes, :mod:`ast` module defines these utility functions
and classes for traversing abstract syntax trees:
-.. function:: parse(expr, filename='<unknown>', mode='exec')
+.. function:: parse(source, filename='<unknown>', mode='exec')
- Parse an expression into an AST node. Equivalent to ``compile(expr,
+ Parse the source into an AST node. Equivalent to ``compile(source,
filename, mode, ast.PyCF_ONLY_AST)``.
diff --git a/Lib/ast.py b/Lib/ast.py
index ba880c9..72237ed 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -28,12 +28,12 @@ from _ast import *
from _ast import __version__
-def parse(expr, filename='<unknown>', mode='exec'):
+def parse(source, filename='<unknown>', mode='exec'):
"""
- Parse an expression into an AST node.
- Equivalent to compile(expr, filename, mode, PyCF_ONLY_AST).
+ Parse the source into an AST node.
+ Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
"""
- return compile(expr, filename, mode, PyCF_ONLY_AST)
+ return compile(source, filename, mode, PyCF_ONLY_AST)
def literal_eval(node_or_string):