summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-08-29 22:50:45 (GMT)
committerGitHub <noreply@github.com>2018-08-29 22:50:45 (GMT)
commitfbca90856d96273fd87c0b126f6e7966af7fbf7b (patch)
tree70be23311a03992573d5fb029acb03b208613440 /Python/bltinmodule.c
parentde427556746aa41a8b5198924ce423021bc0c718 (diff)
downloadcpython-fbca90856d96273fd87c0b126f6e7966af7fbf7b.zip
cpython-fbca90856d96273fd87c0b126f6e7966af7fbf7b.tar.gz
cpython-fbca90856d96273fd87c0b126f6e7966af7fbf7b.tar.bz2
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.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 8aa1ba0..a23bdc1 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;