@@ -417,7 +417,7 @@ handled by the symbol analysis pass.
417
417
struct compiler {
418
418
PyObject * c_filename ;
419
419
struct symtable * c_st ;
420
- PyFutureFeatures * c_future ; /* pointer to module's __future__ */
420
+ PyFutureFeatures c_future ; /* module's __future__ */
421
421
PyCompilerFlags * c_flags ;
422
422
423
423
int c_optimize ; /* optimization level */
@@ -619,14 +619,14 @@ _PyAST_Compile(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
619
619
Py_INCREF (filename );
620
620
c .c_filename = filename ;
621
621
c .c_arena = arena ;
622
- c .c_future = _PyFuture_FromAST (mod , filename );
623
- if (c .c_future == NULL )
622
+ if (!_PyFuture_FromAST (mod , filename , & c .c_future )) {
624
623
goto finally ;
624
+ }
625
625
if (!flags ) {
626
626
flags = & local_flags ;
627
627
}
628
- merged = c .c_future -> ff_features | flags -> cf_flags ;
629
- c .c_future -> ff_features = merged ;
628
+ merged = c .c_future . ff_features | flags -> cf_flags ;
629
+ c .c_future . ff_features = merged ;
630
630
flags -> cf_flags = merged ;
631
631
c .c_flags = flags ;
632
632
c .c_optimize = (optimize == -1 ) ? _Py_GetConfig ()-> optimization_level : optimize ;
@@ -640,7 +640,7 @@ _PyAST_Compile(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
640
640
goto finally ;
641
641
}
642
642
643
- c .c_st = _PySymtable_Build (mod , filename , c .c_future );
643
+ c .c_st = _PySymtable_Build (mod , filename , & c .c_future );
644
644
if (c .c_st == NULL ) {
645
645
if (!PyErr_Occurred ())
646
646
PyErr_SetString (PyExc_SystemError , "no symtable" );
@@ -660,8 +660,6 @@ compiler_free(struct compiler *c)
660
660
{
661
661
if (c -> c_st )
662
662
_PySymtable_Free (c -> c_st );
663
- if (c -> c_future )
664
- PyObject_Free (c -> c_future );
665
663
Py_XDECREF (c -> c_filename );
666
664
Py_DECREF (c -> c_const_cache );
667
665
Py_DECREF (c -> c_stack );
@@ -2404,7 +2402,7 @@ compiler_visit_argannotation(struct compiler *c, identifier id,
2404
2402
ADDOP_LOAD_CONST (c , loc , mangled );
2405
2403
Py_DECREF (mangled );
2406
2404
2407
- if (c -> c_future -> ff_features & CO_FUTURE_ANNOTATIONS ) {
2405
+ if (c -> c_future . ff_features & CO_FUTURE_ANNOTATIONS ) {
2408
2406
VISIT (c , annexpr , annotation );
2409
2407
}
2410
2408
else {
@@ -3927,7 +3925,7 @@ compiler_from_import(struct compiler *c, stmt_ty s)
3927
3925
PyTuple_SET_ITEM (names , i , alias -> name );
3928
3926
}
3929
3927
3930
- if (location_is_after (LOC (s ), c -> c_future -> ff_location ) &&
3928
+ if (location_is_after (LOC (s ), c -> c_future . ff_location ) &&
3931
3929
s -> v .ImportFrom .module &&
3932
3930
_PyUnicode_EqualToASCIIString (s -> v .ImportFrom .module , "__future__" ))
3933
3931
{
@@ -6056,7 +6054,7 @@ check_annotation(struct compiler *c, stmt_ty s)
6056
6054
{
6057
6055
/* Annotations of complex targets does not produce anything
6058
6056
under annotations future */
6059
- if (c -> c_future -> ff_features & CO_FUTURE_ANNOTATIONS ) {
6057
+ if (c -> c_future . ff_features & CO_FUTURE_ANNOTATIONS ) {
6060
6058
return 1 ;
6061
6059
}
6062
6060
@@ -6122,7 +6120,7 @@ compiler_annassign(struct compiler *c, stmt_ty s)
6122
6120
if (s -> v .AnnAssign .simple &&
6123
6121
(c -> u -> u_scope_type == COMPILER_SCOPE_MODULE ||
6124
6122
c -> u -> u_scope_type == COMPILER_SCOPE_CLASS )) {
6125
- if (c -> c_future -> ff_features & CO_FUTURE_ANNOTATIONS ) {
6123
+ if (c -> c_future . ff_features & CO_FUTURE_ANNOTATIONS ) {
6126
6124
VISIT (c , annexpr , s -> v .AnnAssign .annotation )
6127
6125
}
6128
6126
else {
0 commit comments