summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-14 15:34:56 (GMT)
committerGitHub <noreply@github.com>2019-05-14 15:34:56 (GMT)
commitc96be811fa7da8ddcea18cc7abcae94e0f5ff966 (patch)
treef3c6833ba92a084dc604498aecef6ef9103d6dfa /Python/compile.c
parent3c93153f7db5dd9b06f229e61978fd9199b3c097 (diff)
downloadcpython-c96be811fa7da8ddcea18cc7abcae94e0f5ff966.zip
cpython-c96be811fa7da8ddcea18cc7abcae94e0f5ff966.tar.gz
cpython-c96be811fa7da8ddcea18cc7abcae94e0f5ff966.tar.bz2
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.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index dd27ba8..91ce04b 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)) {