@@ -21,7 +21,7 @@ typedef struct {
2121
2222 _Py_c_array_t cf_finally ; /* context for PEP 765 check */
2323 int cf_finally_used ;
24- } _PyASTProcessState ;
24+ } _PyASTPreprocessState ;
2525
2626#define ENTER_RECURSIVE () \
2727if (Py_EnterRecursiveCall(" during compilation")) { \
@@ -31,14 +31,14 @@ if (Py_EnterRecursiveCall(" during compilation")) { \
3131#define LEAVE_RECURSIVE () Py_LeaveRecursiveCall();
3232
3333static ControlFlowInFinallyContext *
34- get_cf_finally_top (_PyASTProcessState * state )
34+ get_cf_finally_top (_PyASTPreprocessState * state )
3535{
3636 int idx = state -> cf_finally_used ;
3737 return ((ControlFlowInFinallyContext * )state -> cf_finally .array ) + idx ;
3838}
3939
4040static int
41- push_cf_context (_PyASTProcessState * state , stmt_ty node , bool finally , bool funcdef , bool loop )
41+ push_cf_context (_PyASTPreprocessState * state , stmt_ty node , bool finally , bool funcdef , bool loop )
4242{
4343 if (_Py_CArray_EnsureCapacity (& state -> cf_finally , state -> cf_finally_used + 1 ) < 0 ) {
4444 return 0 ;
@@ -54,14 +54,14 @@ push_cf_context(_PyASTProcessState *state, stmt_ty node, bool finally, bool func
5454}
5555
5656static void
57- pop_cf_context (_PyASTProcessState * state )
57+ pop_cf_context (_PyASTPreprocessState * state )
5858{
5959 assert (state -> cf_finally_used > 0 );
6060 state -> cf_finally_used -- ;
6161}
6262
6363static int
64- control_flow_in_finally_warning (const char * kw , stmt_ty n , _PyASTProcessState * state )
64+ control_flow_in_finally_warning (const char * kw , stmt_ty n , _PyASTPreprocessState * state )
6565{
6666 PyObject * msg = PyUnicode_FromFormat ("'%s' in a 'finally' block" , kw );
6767 if (msg == NULL ) {
@@ -75,7 +75,7 @@ control_flow_in_finally_warning(const char *kw, stmt_ty n, _PyASTProcessState *s
7575}
7676
7777static int
78- before_return (_PyASTProcessState * state , stmt_ty node_ )
78+ before_return (_PyASTPreprocessState * state , stmt_ty node_ )
7979{
8080 if (state -> cf_finally_used > 0 ) {
8181 ControlFlowInFinallyContext * ctx = get_cf_finally_top (state );
@@ -89,7 +89,7 @@ before_return(_PyASTProcessState *state, stmt_ty node_)
8989}
9090
9191static int
92- before_loop_exit (_PyASTProcessState * state , stmt_ty node_ , const char * kw )
92+ before_loop_exit (_PyASTPreprocessState * state , stmt_ty node_ , const char * kw )
9393{
9494 if (state -> cf_finally_used > 0 ) {
9595 ControlFlowInFinallyContext * ctx = get_cf_finally_top (state );
@@ -364,7 +364,7 @@ optimize_format(expr_ty node, PyObject *fmt, asdl_expr_seq *elts, PyArena *arena
364364}
365365
366366static int
367- fold_binop (expr_ty node , PyArena * arena , _PyASTProcessState * state )
367+ fold_binop (expr_ty node , PyArena * arena , _PyASTPreprocessState * state )
368368{
369369 if (state -> syntax_check_only ) {
370370 return 1 ;
@@ -388,18 +388,18 @@ fold_binop(expr_ty node, PyArena *arena, _PyASTProcessState *state)
388388 return 1 ;
389389}
390390
391- static int astfold_mod (mod_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
392- static int astfold_stmt (stmt_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
393- static int astfold_expr (expr_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
394- static int astfold_arguments (arguments_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
395- static int astfold_comprehension (comprehension_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
396- static int astfold_keyword (keyword_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
397- static int astfold_arg (arg_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
398- static int astfold_withitem (withitem_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
399- static int astfold_excepthandler (excepthandler_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
400- static int astfold_match_case (match_case_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
401- static int astfold_pattern (pattern_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
402- static int astfold_type_param (type_param_ty node_ , PyArena * ctx_ , _PyASTProcessState * state );
391+ static int astfold_mod (mod_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
392+ static int astfold_stmt (stmt_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
393+ static int astfold_expr (expr_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
394+ static int astfold_arguments (arguments_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
395+ static int astfold_comprehension (comprehension_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
396+ static int astfold_keyword (keyword_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
397+ static int astfold_arg (arg_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
398+ static int astfold_withitem (withitem_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
399+ static int astfold_excepthandler (excepthandler_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
400+ static int astfold_match_case (match_case_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
401+ static int astfold_pattern (pattern_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
402+ static int astfold_type_param (type_param_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state );
403403
404404#define CALL (FUNC , TYPE , ARG ) \
405405 if (!FUNC((ARG), ctx_, state)) \
@@ -435,7 +435,7 @@ stmt_seq_remove_item(asdl_stmt_seq *stmts, Py_ssize_t idx)
435435}
436436
437437static int
438- astfold_body (asdl_stmt_seq * stmts , PyArena * ctx_ , _PyASTProcessState * state )
438+ astfold_body (asdl_stmt_seq * stmts , PyArena * ctx_ , _PyASTPreprocessState * state )
439439{
440440 int docstring = _PyAST_GetDocString (stmts ) != NULL ;
441441 if (docstring && (state -> optimize >= 2 )) {
@@ -465,7 +465,7 @@ astfold_body(asdl_stmt_seq *stmts, PyArena *ctx_, _PyASTProcessState *state)
465465}
466466
467467static int
468- astfold_mod (mod_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
468+ astfold_mod (mod_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
469469{
470470 switch (node_ -> kind ) {
471471 case Module_kind :
@@ -487,7 +487,7 @@ astfold_mod(mod_ty node_, PyArena *ctx_, _PyASTProcessState *state)
487487}
488488
489489static int
490- astfold_expr (expr_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
490+ astfold_expr (expr_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
491491{
492492 ENTER_RECURSIVE ();
493493 switch (node_ -> kind ) {
@@ -612,14 +612,14 @@ astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTProcessState *state)
612612}
613613
614614static int
615- astfold_keyword (keyword_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
615+ astfold_keyword (keyword_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
616616{
617617 CALL (astfold_expr , expr_ty , node_ -> value );
618618 return 1 ;
619619}
620620
621621static int
622- astfold_comprehension (comprehension_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
622+ astfold_comprehension (comprehension_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
623623{
624624 CALL (astfold_expr , expr_ty , node_ -> target );
625625 CALL (astfold_expr , expr_ty , node_ -> iter );
@@ -628,7 +628,7 @@ astfold_comprehension(comprehension_ty node_, PyArena *ctx_, _PyASTProcessState
628628}
629629
630630static int
631- astfold_arguments (arguments_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
631+ astfold_arguments (arguments_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
632632{
633633 CALL_SEQ (astfold_arg , arg , node_ -> posonlyargs );
634634 CALL_SEQ (astfold_arg , arg , node_ -> args );
@@ -641,7 +641,7 @@ astfold_arguments(arguments_ty node_, PyArena *ctx_, _PyASTProcessState *state)
641641}
642642
643643static int
644- astfold_arg (arg_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
644+ astfold_arg (arg_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
645645{
646646 if (!(state -> ff_features & CO_FUTURE_ANNOTATIONS )) {
647647 CALL_OPT (astfold_expr , expr_ty , node_ -> annotation );
@@ -650,7 +650,7 @@ astfold_arg(arg_ty node_, PyArena *ctx_, _PyASTProcessState *state)
650650}
651651
652652static int
653- astfold_stmt (stmt_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
653+ astfold_stmt (stmt_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
654654{
655655 ENTER_RECURSIVE ();
656656 switch (node_ -> kind ) {
@@ -805,7 +805,7 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTProcessState *state)
805805}
806806
807807static int
808- astfold_excepthandler (excepthandler_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
808+ astfold_excepthandler (excepthandler_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
809809{
810810 switch (node_ -> kind ) {
811811 case ExceptHandler_kind :
@@ -819,15 +819,15 @@ astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTProcessState
819819}
820820
821821static int
822- astfold_withitem (withitem_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
822+ astfold_withitem (withitem_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
823823{
824824 CALL (astfold_expr , expr_ty , node_ -> context_expr );
825825 CALL_OPT (astfold_expr , expr_ty , node_ -> optional_vars );
826826 return 1 ;
827827}
828828
829829static int
830- fold_const_match_patterns (expr_ty node , PyArena * ctx_ , _PyASTProcessState * state )
830+ fold_const_match_patterns (expr_ty node , PyArena * ctx_ , _PyASTPreprocessState * state )
831831{
832832 if (state -> syntax_check_only ) {
833833 return 1 ;
@@ -868,7 +868,7 @@ fold_const_match_patterns(expr_ty node, PyArena *ctx_, _PyASTProcessState *state
868868}
869869
870870static int
871- astfold_pattern (pattern_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
871+ astfold_pattern (pattern_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
872872{
873873 // Currently, this is really only used to form complex/negative numeric
874874 // constants in MatchValue and MatchMapping nodes
@@ -910,7 +910,7 @@ astfold_pattern(pattern_ty node_, PyArena *ctx_, _PyASTProcessState *state)
910910}
911911
912912static int
913- astfold_match_case (match_case_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
913+ astfold_match_case (match_case_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
914914{
915915 CALL (astfold_pattern , expr_ty , node_ -> pattern );
916916 CALL_OPT (astfold_expr , expr_ty , node_ -> guard );
@@ -919,7 +919,7 @@ astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTProcessState *state
919919}
920920
921921static int
922- astfold_type_param (type_param_ty node_ , PyArena * ctx_ , _PyASTProcessState * state )
922+ astfold_type_param (type_param_ty node_ , PyArena * ctx_ , _PyASTPreprocessState * state )
923923{
924924 switch (node_ -> kind ) {
925925 case TypeVar_kind :
944944_PyAST_Preprocess (mod_ty mod , PyArena * arena , PyObject * filename , int optimize ,
945945 int ff_features , int syntax_check_only )
946946{
947- _PyASTProcessState state ;
948- memset (& state , 0 , sizeof (_PyASTProcessState ));
947+ _PyASTPreprocessState state ;
948+ memset (& state , 0 , sizeof (_PyASTPreprocessState ));
949949 state .filename = filename ;
950950 state .optimize = optimize ;
951951 state .ff_features = ff_features ;
0 commit comments