bpo-37253: Add _PyCompilerFlags_INIT macro (GH-14018) · python/cpython@37d66d7
@@ -91,7 +91,7 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags *
9191{
9292PyObject *filename, *v;
9393int ret, err;
94-PyCompilerFlags local_flags;
94+PyCompilerFlags local_flags = _PyCompilerFlags_INIT;
9595int nomem_count = 0;
9696#ifdef Py_REF_DEBUG
9797int show_ref_count = _PyInterpreterState_Get()->config.show_ref_count;
@@ -105,8 +105,6 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags *
105105106106if (flags == NULL) {
107107flags = &local_flags;
108-local_flags.cf_flags = 0;
109-local_flags.cf_feature_version = PY_MINOR_VERSION;
110108 }
111109v = _PySys_GetObjectId(&PyId_ps1);
112110if (v == NULL) {
@@ -1283,10 +1281,7 @@ _Py_SourceAsString(PyObject *cmd, const char *funcname, const char *what, PyComp
12831281struct symtable *
12841282Py_SymtableStringObject(const char *str, PyObject *filename, int start)
12851283{
1286-PyCompilerFlags flags;
1287-1288-flags.cf_flags = 0;
1289-flags.cf_feature_version = PY_MINOR_VERSION;
1284+PyCompilerFlags flags = _PyCompilerFlags_INIT;
12901285return _Py_SymtableStringObjectFlags(str, filename, start, &flags);
12911286}
12921287@@ -1331,7 +1326,7 @@ PyParser_ASTFromStringObject(const char *s, PyObject *filename, int start,
13311326PyCompilerFlags *flags, PyArena *arena)
13321327{
13331328mod_ty mod;
1334-PyCompilerFlags localflags;
1329+PyCompilerFlags localflags = _PyCompilerFlags_INIT;
13351330perrdetail err;
13361331int iflags = PARSER_FLAGS(flags);
13371332if (flags && flags->cf_feature_version < 7)
@@ -1341,8 +1336,6 @@ PyParser_ASTFromStringObject(const char *s, PyObject *filename, int start,
13411336&_PyParser_Grammar, start, &err,
13421337&iflags);
13431338if (flags == NULL) {
1344-localflags.cf_flags = 0;
1345-localflags.cf_feature_version = PY_MINOR_VERSION;
13461339flags = &localflags;
13471340 }
13481341if (n) {
@@ -1379,16 +1372,14 @@ PyParser_ASTFromFileObject(FILE *fp, PyObject *filename, const char* enc,
13791372PyArena *arena)
13801373{
13811374mod_ty mod;
1382-PyCompilerFlags localflags;
1375+PyCompilerFlags localflags = _PyCompilerFlags_INIT;
13831376perrdetail err;
13841377int iflags = PARSER_FLAGS(flags);
1385137813861379node *n = PyParser_ParseFileObject(fp, filename, enc,
13871380&_PyParser_Grammar,
13881381start, ps1, ps2, &err, &iflags);
13891382if (flags == NULL) {
1390-localflags.cf_flags = 0;
1391-localflags.cf_feature_version = PY_MINOR_VERSION;
13921383flags = &localflags;
13931384 }
13941385if (n) {