Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-45292: [PEP-654] add except*#29581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
b0ca0b7cad9126798aaa7f95272cca44878adc834de3fa2f71908fd85846329f9a626cfdc948b488f9fa4eff693211d6da03dbf43704bc8fff36e5d73ee29451e817850a21261d9969d4a7bf9f3ad5d4128133637e548055736f1582a4db3a461e7dbe609b3706e54b7f49575ae729f338e3b50ee53c8d9c188627428b15bbe44fb22bf20766d830af2b74a5035fe5c5d52de3a1591f0ce3621120d9ccd3a642e613e0d0f078f050a91b219564b8a0File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -403,6 +403,8 @@ try_stmt[stmt_ty]: | ||
| | invalid_try_stmt | ||
| | 'try' &&':' b=block f=finally_block{_PyAST_Try(b, NULL, NULL, f, EXTRA) } | ||
| | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ el=[else_block] f=[finally_block]{_PyAST_Try(b, ex, el, f, EXTRA) } | ||
| | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ el=[else_block] f=[finally_block]{_PyAST_TryStar(b, ex, el, f, EXTRA) } | ||
| # Except statement | ||
| # ---------------- | ||
| @@ -413,6 +415,11 @@ except_block[excepthandler_ty]: | ||
| _PyAST_ExceptHandler(e, (t) ? ((expr_ty) t)->v.Name.id : NULL, b, EXTRA) } | ||
| | 'except' ':' b=block{_PyAST_ExceptHandler(NULL, NULL, b, EXTRA) } | ||
| | invalid_except_stmt | ||
| except_star_block[excepthandler_ty]: | ||
| | invalid_except_star_stmt_indent | ||
iritkatriel marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| | 'except' '*' e=expression t=['as' z=NAME{z }] ':' b=block{ | ||
| _PyAST_ExceptHandler(e, (t) ? ((expr_ty) t)->v.Name.id : NULL, b, EXTRA) } | ||
| | invalid_except_stmt | ||
| finally_block[asdl_stmt_seq*]: | ||
| | invalid_finally_stmt | ||
| | 'finally' &&':' a=block{a } | ||
| @@ -1192,18 +1199,24 @@ invalid_try_stmt: | ||
| | a='try' ':' NEWLINE !INDENT{ | ||
| RAISE_INDENTATION_ERROR("expected an indented block after 'try' statement on line %d", a->lineno) } | ||
| | 'try' ':' block !('except' | 'finally'){RAISE_SYNTAX_ERROR("expected 'except' or 'finally' block") } | ||
| | 'try' ':' block* ((except_block+ except_star_block) | (except_star_block+ except_block)) block*{ | ||
| RAISE_SYNTAX_ERROR("cannot have both 'except' and 'except*' on the same 'try'") } | ||
| invalid_except_stmt: | ||
| | 'except' a=expression ',' expressions ['as' NAME ] ':'{ | ||
| | 'except' '*'? a=expression ',' expressions ['as' NAME ] ':'{ | ||
| RAISE_SYNTAX_ERROR_STARTING_FROM(a, "multiple exception types must be parenthesized") } | ||
| | a='except' expression ['as' NAME ] NEWLINE{RAISE_SYNTAX_ERROR("expected ':'") } | ||
| | a='except' '*'? expression ['as' NAME ] NEWLINE{RAISE_SYNTAX_ERROR("expected ':'") } | ||
| | a='except' NEWLINE{RAISE_SYNTAX_ERROR("expected ':'") } | ||
| | a='except' '*' (NEWLINE | ':'){RAISE_SYNTAX_ERROR("expected one or more exception types") } | ||
| invalid_finally_stmt: | ||
| | a='finally' ':' NEWLINE !INDENT{ | ||
| RAISE_INDENTATION_ERROR("expected an indented block after 'finally' statement on line %d", a->lineno) } | ||
| invalid_except_stmt_indent: | ||
| | a='except' expression ['as' NAME ] ':' NEWLINE !INDENT{ | ||
| RAISE_INDENTATION_ERROR("expected an indented block after 'except' statement on line %d", a->lineno) } | ||
| | a='except' ':' NEWLINE !INDENT{RAISE_SYNTAX_ERROR("expected an indented block after except statement on line %d", a->lineno) } | ||
| invalid_except_star_stmt_indent: | ||
| | a='except' '*' expression ['as' NAME ] ':' NEWLINE !INDENT{ | ||
| RAISE_INDENTATION_ERROR("expected an indented block after 'except*' statement on line %d", a->lineno) } | ||
| invalid_match_stmt: | ||
| | "match" subject_expr !':'{CHECK_VERSION(void*, 10, "Pattern matching is", RAISE_SYNTAX_ERROR("expected ':'") ) } | ||
| | a="match" subject=subject_expr ':' NEWLINE !INDENT{ | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.