@@ -443,26 +443,30 @@ try_stmt[stmt_ty]:
443443
444444except_block[excepthandler_ty]:
445445 | invalid_except_stmt_indent
446+ | 'except' e=expression ':' b=block {
447+ _PyAST_ExceptHandler(e, NULL, b, EXTRA) }
448+ | 'except' e=expression 'as' t=NAME ':' b=block {
449+ _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
446450 | 'except' e=expressions ':' b=block {
447451 CHECK_VERSION(
448452 excepthandler_ty,
449453 14,
450- "except expressions without parentheses",
451- _PyAST_ExceptHandler(e, NULL, b, EXTRA)) }
452- | 'except' e=expression 'as' t=NAME ':' b=block {
453- _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
454+ "except expressions without parentheses are",
455+ _PyAST_ExceptHandler(e, NULL, b, EXTRA)) }
454456 | 'except' ':' b=block { _PyAST_ExceptHandler(NULL, NULL, b, EXTRA) }
455457 | invalid_except_stmt
456458except_star_block[excepthandler_ty]:
457459 | invalid_except_star_stmt_indent
460+ | 'except' '*' e=expression ':' b=block {
461+ _PyAST_ExceptHandler(e, NULL, b, EXTRA) }
462+ | 'except' '*' e=expression 'as' t=NAME ':' b=block {
463+ _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
458464 | 'except' '*' e=expressions ':' b=block {
459465 CHECK_VERSION(
460466 excepthandler_ty,
461467 14,
462- "except expressions without parentheses",
468+ "except expressions without parentheses are ",
463469 _PyAST_ExceptHandler(e, NULL, b, EXTRA)) }
464- | 'except' '*' e=expression 'as' t=NAME ':' b=block {
465- _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
466470 | invalid_except_star_stmt
467471finally_block[asdl_stmt_seq*]:
468472 | invalid_finally_stmt
0 commit comments