mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Backport PEP 3110's new 'except' syntax to 2.6.
This commit is contained in:
parent
6eb7bede72
commit
6290305e67
6 changed files with 12 additions and 7 deletions
|
@ -600,7 +600,7 @@ hello world
|
|||
def testTry(self):
|
||||
### try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite]
|
||||
### | 'try' ':' suite 'finally' ':' suite
|
||||
### except_clause: 'except' [expr [',' expr]]
|
||||
### except_clause: 'except' [expr [('as' | ',') expr]]
|
||||
try:
|
||||
1/0
|
||||
except ZeroDivisionError:
|
||||
|
@ -609,7 +609,7 @@ hello world
|
|||
pass
|
||||
try: 1/0
|
||||
except EOFError: pass
|
||||
except TypeError, msg: pass
|
||||
except TypeError as msg: pass
|
||||
except RuntimeError, msg: pass
|
||||
except: pass
|
||||
else: pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue