mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
unify TryExcept and TryFinally (closes #12199)
This commit is contained in:
parent
f7d08e8522
commit
43af12b0b4
8 changed files with 78 additions and 156 deletions
|
@ -66,10 +66,9 @@ struct _mod {
|
|||
enum _stmt_kind {FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3,
|
||||
Delete_kind=4, Assign_kind=5, AugAssign_kind=6, For_kind=7,
|
||||
While_kind=8, If_kind=9, With_kind=10, Raise_kind=11,
|
||||
TryExcept_kind=12, TryFinally_kind=13, Assert_kind=14,
|
||||
Import_kind=15, ImportFrom_kind=16, Global_kind=17,
|
||||
Nonlocal_kind=18, Expr_kind=19, Pass_kind=20, Break_kind=21,
|
||||
Continue_kind=22};
|
||||
Try_kind=12, Assert_kind=13, Import_kind=14,
|
||||
ImportFrom_kind=15, Global_kind=16, Nonlocal_kind=17,
|
||||
Expr_kind=18, Pass_kind=19, Break_kind=20, Continue_kind=21};
|
||||
struct _stmt {
|
||||
enum _stmt_kind kind;
|
||||
union {
|
||||
|
@ -143,12 +142,8 @@ struct _stmt {
|
|||
asdl_seq *body;
|
||||
asdl_seq *handlers;
|
||||
asdl_seq *orelse;
|
||||
} TryExcept;
|
||||
|
||||
struct {
|
||||
asdl_seq *body;
|
||||
asdl_seq *finalbody;
|
||||
} TryFinally;
|
||||
} Try;
|
||||
|
||||
struct {
|
||||
expr_ty test;
|
||||
|
@ -433,12 +428,10 @@ stmt_ty _Py_With(asdl_seq * items, asdl_seq * body, int lineno, int col_offset,
|
|||
#define Raise(a0, a1, a2, a3, a4) _Py_Raise(a0, a1, a2, a3, a4)
|
||||
stmt_ty _Py_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset,
|
||||
PyArena *arena);
|
||||
#define TryExcept(a0, a1, a2, a3, a4, a5) _Py_TryExcept(a0, a1, a2, a3, a4, a5)
|
||||
stmt_ty _Py_TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse,
|
||||
int lineno, int col_offset, PyArena *arena);
|
||||
#define TryFinally(a0, a1, a2, a3, a4) _Py_TryFinally(a0, a1, a2, a3, a4)
|
||||
stmt_ty _Py_TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define Try(a0, a1, a2, a3, a4, a5, a6) _Py_Try(a0, a1, a2, a3, a4, a5, a6)
|
||||
stmt_ty _Py_Try(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse,
|
||||
asdl_seq * finalbody, int lineno, int col_offset, PyArena
|
||||
*arena);
|
||||
#define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4)
|
||||
stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset,
|
||||
PyArena *arena);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue