From feac624827a6523e29f69210d69a0627d19bfd2b Mon Sep 17 00:00:00 2001 From: Terry Reedy Date: Mon, 24 Jan 2011 21:36:03 +0000 Subject: [PATCH] Issue #11000 ast.parse parses source, not just expressions. --- Doc/library/ast.rst | 4 ++-- Lib/ast.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index ca8af56f2da..e2c0b6d17d9 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='', mode='exec') +.. function:: parse(source, filename='', 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 ba880c93ec0..72237ed9085 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -28,12 +28,12 @@ from _ast import * from _ast import __version__ -def parse(expr, filename='', mode='exec'): +def parse(source, filename='', 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):