File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -235,6 +235,12 @@ def test_try_stmt(self):
235
235
self .check_suite ("try: pass\n except: pass\n else: pass\n "
236
236
"finally: pass\n " )
237
237
238
+ def test_except_clause (self ):
239
+ self .check_suite ("try: pass\n except: pass\n " )
240
+ self .check_suite ("try: pass\n except A: pass\n " )
241
+ self .check_suite ("try: pass\n except A, e: pass\n " )
242
+ self .check_suite ("try: pass\n except A as e: pass\n " )
243
+
238
244
def test_position (self ):
239
245
# An absolutely minimal test of position information. Better
240
246
# tests would be a big project.
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ Library
20
20
- Issue #9075: In the ssl module, remove the setting of a ``debug`` flag
21
21
on an OpenSSL structure.
22
22
23
+ - Issue #9125: Add recognition of 'except ... as ...' syntax to parser module.
23
24
24
25
What's New in Python 2.7 release candidate 2?
25
26
=============================================
Original file line number Diff line number Diff line change @@ -2126,10 +2126,13 @@ validate_except_clause(node *tree)
2126
2126
2127
2127
if (res && (nch > 1 ))
2128
2128
res = validate_test (CHILD (tree , 1 ));
2129
- if (res && (nch == 4 ))
2130
- res = (validate_comma (CHILD (tree , 2 ))
2131
- && validate_test (CHILD (tree , 3 )));
2132
-
2129
+ if (res && (nch == 4 )) {
2130
+ if (TYPE (CHILD (tree , 2 )) == NAME )
2131
+ res = validate_name (CHILD (tree , 2 ), "as" );
2132
+ else
2133
+ res = validate_comma (CHILD (tree , 2 ));
2134
+ res = res && validate_test (CHILD (tree , 3 ));
2135
+ }
2133
2136
return (res );
2134
2137
}
2135
2138
You can’t perform that action at this time.
0 commit comments