122122 (opcode) == STORE_FAST__STORE_FAST)
123123
124124#define IS_TOP_LEVEL_AWAIT (c ) ( \
125- (c->c_flags-> cf_flags & PyCF_ALLOW_TOP_LEVEL_AWAIT) \
125+ (c->c_flags. cf_flags & PyCF_ALLOW_TOP_LEVEL_AWAIT) \
126126 && (c->u->u_ste->ste_type == ModuleBlock))
127127
128128typedef _PyCompilerSrcLocation location ;
@@ -418,7 +418,7 @@ struct compiler {
418418 PyObject * c_filename ;
419419 struct symtable * c_st ;
420420 PyFutureFeatures c_future ; /* module's __future__ */
421- PyCompilerFlags * c_flags ;
421+ PyCompilerFlags c_flags ;
422422
423423 int c_optimize ; /* optimization level */
424424 int c_interactive ; /* true if in interactive mode */
@@ -608,17 +608,17 @@ compiler_init(struct compiler *c)
608608
609609static int
610610compiler_setup (struct compiler * c , mod_ty mod , PyObject * filename ,
611- PyCompilerFlags * flags , int optimize , PyArena * arena )
611+ PyCompilerFlags flags , int optimize , PyArena * arena )
612612{
613613 Py_INCREF (filename );
614614 c -> c_filename = filename ;
615615 c -> c_arena = arena ;
616616 if (!_PyFuture_FromAST (mod , filename , & c -> c_future )) {
617617 return 0 ;
618618 }
619- int merged = c -> c_future .ff_features | flags -> cf_flags ;
619+ int merged = c -> c_future .ff_features | flags . cf_flags ;
620620 c -> c_future .ff_features = merged ;
621- flags -> cf_flags = merged ;
621+ flags . cf_flags = merged ;
622622 c -> c_flags = flags ;
623623 c -> c_optimize = (optimize == -1 ) ? _Py_GetConfig ()-> optimization_level : optimize ;
624624 c -> c_nestlevel = 0 ;
@@ -641,18 +641,15 @@ compiler_setup(struct compiler *c, mod_ty mod, PyObject *filename,
641641}
642642
643643PyCodeObject *
644- _PyAST_Compile (mod_ty mod , PyObject * filename , PyCompilerFlags * flags ,
644+ _PyAST_Compile (mod_ty mod , PyObject * filename , PyCompilerFlags * pflags ,
645645 int optimize , PyArena * arena )
646646{
647647 struct compiler c ;
648648 if (!compiler_init (& c )) {
649649 return NULL ;
650650 }
651651
652- PyCompilerFlags local_flags = _PyCompilerFlags_INIT ;
653- if (!flags ) {
654- flags = & local_flags ;
655- }
652+ PyCompilerFlags flags = pflags ? * pflags : _PyCompilerFlags_INIT ;
656653
657654 PyCodeObject * co = NULL ;
658655 if (!compiler_setup (& c , mod , filename , flags , optimize , arena )) {
@@ -8284,7 +8281,7 @@ compute_code_flags(struct compiler *c)
82848281 }
82858282
82868283 /* (Only) inherit compilerflags in PyCF_MASK */
8287- flags |= (c -> c_flags -> cf_flags & PyCF_MASK );
8284+ flags |= (c -> c_flags . cf_flags & PyCF_MASK );
82888285
82898286 if ((IS_TOP_LEVEL_AWAIT (c )) &&
82908287 ste -> ste_coroutine &&
@@ -9968,7 +9965,7 @@ cfg_to_instructions(cfg_builder *g)
99689965}
99699966
99709967PyObject *
9971- _PyCompile_CodeGen (PyObject * ast , PyObject * filename , PyCompilerFlags * flags ,
9968+ _PyCompile_CodeGen (PyObject * ast , PyObject * filename , PyCompilerFlags * pflags ,
99729969 int optimize )
99739970{
99749971 PyObject * res = NULL ;
@@ -9996,10 +9993,7 @@ _PyCompile_CodeGen(PyObject *ast, PyObject *filename, PyCompilerFlags *flags,
99969993 return NULL ;
99979994 }
99989995
9999- PyCompilerFlags local_flags = _PyCompilerFlags_INIT ;
10000- if (!flags ) {
10001- flags = & local_flags ;
10002- }
9996+ PyCompilerFlags flags = pflags ? * pflags : _PyCompilerFlags_INIT ;
100039997 if (!compiler_setup (& c , mod , filename , flags , optimize , arena )) {
100049998 goto finally ;
100059999 }
0 commit comments