From fbca90856d96273fd87c0b126f6e7966af7fbf7b Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 30 Aug 2018 00:50:45 +0200 Subject: bpo-34523: Use _PyCoreConfig instead of globals (GH-9005) Use the core configuration of the interpreter, rather than using global configuration variables. For example, replace Py_QuietFlag with core_config->quiet. --- Python/bltinmodule.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Python/bltinmodule.c') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 8aa1ba01d65..a23bdc1078c 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2,6 +2,7 @@ #include "Python.h" #include "Python-ast.h" +#include "internal/pystate.h" #include "node.h" #include "code.h" @@ -2765,6 +2766,8 @@ _PyBuiltin_Init(void) { PyObject *mod, *dict, *debug; + const _PyCoreConfig *config = &_PyInterpreterState_GET_UNSAFE()->core_config; + if (PyType_Ready(&PyFilter_Type) < 0 || PyType_Ready(&PyMap_Type) < 0 || PyType_Ready(&PyZip_Type) < 0) @@ -2823,7 +2826,7 @@ _PyBuiltin_Init(void) SETBUILTIN("tuple", &PyTuple_Type); SETBUILTIN("type", &PyType_Type); SETBUILTIN("zip", &PyZip_Type); - debug = PyBool_FromLong(Py_OptimizeFlag == 0); + debug = PyBool_FromLong(config->optimization_level == 0); if (PyDict_SetItemString(dict, "__debug__", debug) < 0) { Py_DECREF(debug); return NULL; -- cgit v1.2.3-65-gdbad