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.
This commit is contained in:
Victor Stinner 2019-05-14 17:34:56 +02:00 committed by GitHub
parent 3c93153f7d
commit c96be811fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 51 additions and 37 deletions

View file

@ -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)) {