summaryrefslogtreecommitdiff
path: root/Grammar
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-05-25 21:02:56 +0000
committerGeorg Brandl <georg@python.org>2009-05-25 21:02:56 +0000
commit944f684ce6f439bc868d4b189c45f726dfb9d3b1 (patch)
tree3fd9c596e78b01836158508978ce8eab678bb37b /Grammar
parent04516611e7e4ceaef6fef9413719e9cb5b4bb087 (diff)
downloadcpython-git-944f684ce6f439bc868d4b189c45f726dfb9d3b1.tar.gz
Allow multiple context managers in one with statement, as proposed
in http://codereview.appspot.com/53094 and accepted by Guido. The construct is transformed into multiple With AST nodes so that there should be no problems with the semantics.
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/Grammar4
1 files changed, 2 insertions, 2 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar
index 865d44c19d..266ba41b81 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -83,8 +83,8 @@ try_stmt: ('try' ':' suite
['else' ':' suite]
['finally' ':' suite] |
'finally' ':' suite))
-with_stmt: 'with' test [ with_var ] ':' suite
-with_var: 'as' expr
+with_stmt: 'with' with_item (',' with_item)* ':' suite
+with_item: test ['as' expr]
# NB compile.c makes sure that the default except clause is last
except_clause: 'except' [test [('as' | ',') test]]
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT