mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-37253: Add _PyCompilerFlags_INIT macro (GH-14018)
Add a new _PyCompilerFlags_INIT macro to initialize PyCompilerFlags variables, rather than initializing cf_flags and cf_feature_version explicitly in each variable.
This commit is contained in:
parent
2c9b498759
commit
37d66d7d4b
8 changed files with 15 additions and 29 deletions
|
@ -309,7 +309,7 @@ PyAST_CompileObject(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
|
|||
{
|
||||
struct compiler c;
|
||||
PyCodeObject *co = NULL;
|
||||
PyCompilerFlags local_flags;
|
||||
PyCompilerFlags local_flags = _PyCompilerFlags_INIT;
|
||||
int merged;
|
||||
PyConfig *config = &_PyInterpreterState_GET_UNSAFE()->config;
|
||||
|
||||
|
@ -332,8 +332,6 @@ PyAST_CompileObject(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
|
|||
if (c.c_future == NULL)
|
||||
goto finally;
|
||||
if (!flags) {
|
||||
local_flags.cf_flags = 0;
|
||||
local_flags.cf_feature_version = PY_MINOR_VERSION;
|
||||
flags = &local_flags;
|
||||
}
|
||||
merged = c.c_future->ff_features | flags->cf_flags;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue