diff options
author | Georg Brandl <georg@python.org> | 2009-05-25 21:02:56 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-05-25 21:02:56 (GMT) |
commit | 944f684ce6f439bc868d4b189c45f726dfb9d3b1 (patch) | |
tree | 3fd9c596e78b01836158508978ce8eab678bb37b /Grammar | |
parent | 04516611e7e4ceaef6fef9413719e9cb5b4bb087 (diff) | |
download | cpython-944f684ce6f439bc868d4b189c45f726dfb9d3b1.zip cpython-944f684ce6f439bc868d4b189c45f726dfb9d3b1.tar.gz cpython-944f684ce6f439bc868d4b189c45f726dfb9d3b1.tar.bz2 |
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/Grammar | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar index 865d44c..266ba41 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 |