122
122
(opcode) == STORE_FAST__STORE_FAST)
123
123
124
124
#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) \
126
126
&& (c->u->u_ste->ste_type == ModuleBlock))
127
127
128
128
typedef _PyCompilerSrcLocation location ;
@@ -418,7 +418,7 @@ struct compiler {
418
418
PyObject * c_filename ;
419
419
struct symtable * c_st ;
420
420
PyFutureFeatures c_future ; /* module's __future__ */
421
- PyCompilerFlags * c_flags ;
421
+ PyCompilerFlags c_flags ;
422
422
423
423
int c_optimize ; /* optimization level */
424
424
int c_interactive ; /* true if in interactive mode */
@@ -608,17 +608,17 @@ compiler_init(struct compiler *c)
608
608
609
609
static int
610
610
compiler_setup (struct compiler * c , mod_ty mod , PyObject * filename ,
611
- PyCompilerFlags * flags , int optimize , PyArena * arena )
611
+ PyCompilerFlags flags , int optimize , PyArena * arena )
612
612
{
613
613
Py_INCREF (filename );
614
614
c -> c_filename = filename ;
615
615
c -> c_arena = arena ;
616
616
if (!_PyFuture_FromAST (mod , filename , & c -> c_future )) {
617
617
return 0 ;
618
618
}
619
- int merged = c -> c_future .ff_features | flags -> cf_flags ;
619
+ int merged = c -> c_future .ff_features | flags . cf_flags ;
620
620
c -> c_future .ff_features = merged ;
621
- flags -> cf_flags = merged ;
621
+ flags . cf_flags = merged ;
622
622
c -> c_flags = flags ;
623
623
c -> c_optimize = (optimize == -1 ) ? _Py_GetConfig ()-> optimization_level : optimize ;
624
624
c -> c_nestlevel = 0 ;
@@ -641,18 +641,15 @@ compiler_setup(struct compiler *c, mod_ty mod, PyObject *filename,
641
641
}
642
642
643
643
PyCodeObject *
644
- _PyAST_Compile (mod_ty mod , PyObject * filename , PyCompilerFlags * flags ,
644
+ _PyAST_Compile (mod_ty mod , PyObject * filename , PyCompilerFlags * pflags ,
645
645
int optimize , PyArena * arena )
646
646
{
647
647
struct compiler c ;
648
648
if (!compiler_init (& c )) {
649
649
return NULL ;
650
650
}
651
651
652
- PyCompilerFlags local_flags = _PyCompilerFlags_INIT ;
653
- if (!flags ) {
654
- flags = & local_flags ;
655
- }
652
+ PyCompilerFlags flags = pflags ? * pflags : _PyCompilerFlags_INIT ;
656
653
657
654
PyCodeObject * co = NULL ;
658
655
if (!compiler_setup (& c , mod , filename , flags , optimize , arena )) {
@@ -8284,7 +8281,7 @@ compute_code_flags(struct compiler *c)
8284
8281
}
8285
8282
8286
8283
/* (Only) inherit compilerflags in PyCF_MASK */
8287
- flags |= (c -> c_flags -> cf_flags & PyCF_MASK );
8284
+ flags |= (c -> c_flags . cf_flags & PyCF_MASK );
8288
8285
8289
8286
if ((IS_TOP_LEVEL_AWAIT (c )) &&
8290
8287
ste -> ste_coroutine &&
@@ -9968,7 +9965,7 @@ cfg_to_instructions(cfg_builder *g)
9968
9965
}
9969
9966
9970
9967
PyObject *
9971
- _PyCompile_CodeGen (PyObject * ast , PyObject * filename , PyCompilerFlags * flags ,
9968
+ _PyCompile_CodeGen (PyObject * ast , PyObject * filename , PyCompilerFlags * pflags ,
9972
9969
int optimize )
9973
9970
{
9974
9971
PyObject * res = NULL ;
@@ -9996,10 +9993,7 @@ _PyCompile_CodeGen(PyObject *ast, PyObject *filename, PyCompilerFlags *flags,
9996
9993
return NULL ;
9997
9994
}
9998
9995
9999
- PyCompilerFlags local_flags = _PyCompilerFlags_INIT ;
10000
- if (!flags ) {
10001
- flags = & local_flags ;
10002
- }
9996
+ PyCompilerFlags flags = pflags ? * pflags : _PyCompilerFlags_INIT ;
10003
9997
if (!compiler_setup (& c , mod , filename , flags , optimize , arena )) {
10004
9998
goto finally ;
10005
9999
}
0 commit comments