diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2021-12-14 16:48:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-14 16:48:15 (GMT) |
commit | d60457a6673cf0263213c2f2be02c633ec2e2038 (patch) | |
tree | 04461db9079cf30a98c5a4070098f795275aa910 /Include | |
parent | 850aefc2c651110a784cd5478af9774b1f6287a3 (diff) | |
download | cpython-d60457a6673cf0263213c2f2be02c633ec2e2038.zip cpython-d60457a6673cf0263213c2f2be02c633ec2e2038.tar.gz cpython-d60457a6673cf0263213c2f2be02c633ec2e2038.tar.bz2 |
bpo-45292: [PEP-654] add except* (GH-29581)
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_ast.h | 17 | ||||
-rw-r--r-- | Include/internal/pycore_ast_state.h | 1 | ||||
-rw-r--r-- | Include/internal/pycore_pyerrors.h | 8 | ||||
-rw-r--r-- | Include/opcode.h | 6 |
4 files changed, 27 insertions, 5 deletions
diff --git a/Include/internal/pycore_ast.h b/Include/internal/pycore_ast.h index ebb6a90..36277ef 100644 --- a/Include/internal/pycore_ast.h +++ b/Include/internal/pycore_ast.h @@ -179,9 +179,9 @@ enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3, AugAssign_kind=7, AnnAssign_kind=8, For_kind=9, AsyncFor_kind=10, While_kind=11, If_kind=12, With_kind=13, AsyncWith_kind=14, Match_kind=15, Raise_kind=16, Try_kind=17, - Assert_kind=18, Import_kind=19, ImportFrom_kind=20, - Global_kind=21, Nonlocal_kind=22, Expr_kind=23, Pass_kind=24, - Break_kind=25, Continue_kind=26}; + TryStar_kind=18, Assert_kind=19, Import_kind=20, + ImportFrom_kind=21, Global_kind=22, Nonlocal_kind=23, + Expr_kind=24, Pass_kind=25, Break_kind=26, Continue_kind=27}; struct _stmt { enum _stmt_kind kind; union { @@ -296,6 +296,13 @@ struct _stmt { } Try; struct { + asdl_stmt_seq *body; + asdl_excepthandler_seq *handlers; + asdl_stmt_seq *orelse; + asdl_stmt_seq *finalbody; + } TryStar; + + struct { expr_ty test; expr_ty msg; } Assert; @@ -688,6 +695,10 @@ stmt_ty _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); +stmt_ty _PyAST_TryStar(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, + asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); stmt_ty _PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); stmt_ty _PyAST_Import(asdl_alias_seq * names, int lineno, int col_offset, int diff --git a/Include/internal/pycore_ast_state.h b/Include/internal/pycore_ast_state.h index 882cd09..da78bba 100644 --- a/Include/internal/pycore_ast_state.h +++ b/Include/internal/pycore_ast_state.h @@ -132,6 +132,7 @@ struct ast_state { PyObject *Sub_singleton; PyObject *Sub_type; PyObject *Subscript_type; + PyObject *TryStar_type; PyObject *Try_type; PyObject *Tuple_type; PyObject *TypeIgnore_type; diff --git a/Include/internal/pycore_pyerrors.h b/Include/internal/pycore_pyerrors.h index 3134afe..5e8d202 100644 --- a/Include/internal/pycore_pyerrors.h +++ b/Include/internal/pycore_pyerrors.h @@ -92,6 +92,14 @@ PyAPI_FUNC(PyObject *) _PyErr_FormatFromCauseTstate( const char *format, ...); +PyAPI_FUNC(PyObject *) _PyExc_CreateExceptionGroup( + const char *msg, + PyObject *excs); + +PyAPI_FUNC(PyObject *) _PyExc_ExceptionGroupProjection( + PyObject *left, + PyObject *right); + PyAPI_FUNC(int) _PyErr_CheckSignalsTstate(PyThreadState *tstate); PyAPI_FUNC(void) _Py_DumpExtensionModules(int fd, PyInterpreterState *interp); diff --git a/Include/opcode.h b/Include/opcode.h index f22f7e9..1341a8a 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -45,6 +45,7 @@ extern "C" { #define IMPORT_STAR 84 #define SETUP_ANNOTATIONS 85 #define YIELD_VALUE 86 +#define PREP_RERAISE_STAR 88 #define POP_EXCEPT 89 #define HAVE_ARGUMENT 90 #define STORE_NAME 90 @@ -83,6 +84,7 @@ extern "C" { #define LOAD_FAST 124 #define STORE_FAST 125 #define DELETE_FAST 126 +#define JUMP_IF_NOT_EG_MATCH 127 #define GEN_START 129 #define RAISE_VARARGS 130 #define CALL_FUNCTION 131 @@ -161,7 +163,7 @@ extern "C" { #define STORE_FAST__LOAD_FAST 80 #define LOAD_FAST__LOAD_CONST 81 #define LOAD_CONST__LOAD_FAST 87 -#define STORE_FAST__STORE_FAST 88 +#define STORE_FAST__STORE_FAST 123 #define DO_TRACING 255 #ifdef NEED_OPCODE_JUMP_TABLES static uint32_t _PyOpcode_RelativeJump[8] = { @@ -178,7 +180,7 @@ static uint32_t _PyOpcode_Jump[8] = { 0U, 0U, 536870912U, - 34586624U, + 2182070272U, 0U, 0U, 0U, |