@@ -417,7 +417,7 @@ handled by the symbol analysis pass.
417417struct compiler {
418418 PyObject * c_filename ;
419419 struct symtable * c_st ;
420- PyFutureFeatures * c_future ; /* pointer to module's __future__ */
420+ PyFutureFeatures c_future ; /* module's __future__ */
421421 PyCompilerFlags * c_flags ;
422422
423423 int c_optimize ; /* optimization level */
@@ -619,14 +619,14 @@ _PyAST_Compile(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
619619 Py_INCREF (filename );
620620 c .c_filename = filename ;
621621 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 )) {
624623 goto finally ;
624+ }
625625 if (!flags ) {
626626 flags = & local_flags ;
627627 }
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 ;
630630 flags -> cf_flags = merged ;
631631 c .c_flags = flags ;
632632 c .c_optimize = (optimize == -1 ) ? _Py_GetConfig ()-> optimization_level : optimize ;
@@ -640,7 +640,7 @@ _PyAST_Compile(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
640640 goto finally ;
641641 }
642642
643- c .c_st = _PySymtable_Build (mod , filename , c .c_future );
643+ c .c_st = _PySymtable_Build (mod , filename , & c .c_future );
644644 if (c .c_st == NULL ) {
645645 if (!PyErr_Occurred ())
646646 PyErr_SetString (PyExc_SystemError , "no symtable" );
@@ -660,8 +660,6 @@ compiler_free(struct compiler *c)
660660{
661661 if (c -> c_st )
662662 _PySymtable_Free (c -> c_st );
663- if (c -> c_future )
664- PyObject_Free (c -> c_future );
665663 Py_XDECREF (c -> c_filename );
666664 Py_DECREF (c -> c_const_cache );
667665 Py_DECREF (c -> c_stack );
@@ -2404,7 +2402,7 @@ compiler_visit_argannotation(struct compiler *c, identifier id,
24042402 ADDOP_LOAD_CONST (c , loc , mangled );
24052403 Py_DECREF (mangled );
24062404
2407- if (c -> c_future -> ff_features & CO_FUTURE_ANNOTATIONS ) {
2405+ if (c -> c_future . ff_features & CO_FUTURE_ANNOTATIONS ) {
24082406 VISIT (c , annexpr , annotation );
24092407 }
24102408 else {
@@ -3927,7 +3925,7 @@ compiler_from_import(struct compiler *c, stmt_ty s)
39273925 PyTuple_SET_ITEM (names , i , alias -> name );
39283926 }
39293927
3930- if (location_is_after (LOC (s ), c -> c_future -> ff_location ) &&
3928+ if (location_is_after (LOC (s ), c -> c_future . ff_location ) &&
39313929 s -> v .ImportFrom .module &&
39323930 _PyUnicode_EqualToASCIIString (s -> v .ImportFrom .module , "__future__" ))
39333931 {
@@ -6056,7 +6054,7 @@ check_annotation(struct compiler *c, stmt_ty s)
60566054{
60576055 /* Annotations of complex targets does not produce anything
60586056 under annotations future */
6059- if (c -> c_future -> ff_features & CO_FUTURE_ANNOTATIONS ) {
6057+ if (c -> c_future . ff_features & CO_FUTURE_ANNOTATIONS ) {
60606058 return 1 ;
60616059 }
60626060
@@ -6122,7 +6120,7 @@ compiler_annassign(struct compiler *c, stmt_ty s)
61226120 if (s -> v .AnnAssign .simple &&
61236121 (c -> u -> u_scope_type == COMPILER_SCOPE_MODULE ||
61246122 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 ) {
61266124 VISIT (c , annexpr , s -> v .AnnAssign .annotation )
61276125 }
61286126 else {
0 commit comments