From c96be811fa7da8ddcea18cc7abcae94e0f5ff966 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 14 May 2019 17:34:56 +0200 Subject: bpo-36900: Replace global conf vars with config (GH-13299) Replace global configuration variables with core_config read from the current interpreter. Cleanup dynload_hpux.c. --- Python/compile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Python/compile.c') diff --git a/Python/compile.c b/Python/compile.c index dd27ba840f..91ce04b02e 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -24,6 +24,7 @@ #include "Python.h" #include "Python-ast.h" +#include "pycore_pystate.h" /* _PyInterpreterState_GET_UNSAFE() */ #include "ast.h" #include "code.h" #include "symtable.h" @@ -310,6 +311,7 @@ PyAST_CompileObject(mod_ty mod, PyObject *filename, PyCompilerFlags *flags, PyCodeObject *co = NULL; PyCompilerFlags local_flags; int merged; + _PyCoreConfig *config = &_PyInterpreterState_GET_UNSAFE()->core_config; if (!__doc__) { __doc__ = PyUnicode_InternFromString("__doc__"); @@ -338,7 +340,7 @@ PyAST_CompileObject(mod_ty mod, PyObject *filename, PyCompilerFlags *flags, c.c_future->ff_features = merged; flags->cf_flags = merged; c.c_flags = flags; - c.c_optimize = (optimize == -1) ? Py_OptimizeFlag : optimize; + c.c_optimize = (optimize == -1) ? config->optimization_level : optimize; c.c_nestlevel = 0; if (!_PyAST_Optimize(mod, arena, c.c_optimize)) { -- cgit v1.2.1