summaryrefslogtreecommitdiffstats
path: root/Objects/moduleobject.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 /Objects/moduleobject.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 'Objects/moduleobject.c')
-rw-r--r--Objects/moduleobject.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 9d65332..e570107c 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -590,13 +590,15 @@ _PyModule_ClearDict(PyObject *d)
Py_ssize_t pos;
PyObject *key, *value;
+ int verbose = _PyInterpreterState_GET_UNSAFE()->core_config.verbose;
+
/* First, clear only names starting with a single underscore */
pos = 0;
while (PyDict_Next(d, &pos, &key, &value)) {
if (value != Py_None && PyUnicode_Check(key)) {
if (PyUnicode_READ_CHAR(key, 0) == '_' &&
PyUnicode_READ_CHAR(key, 1) != '_') {
- if (Py_VerboseFlag > 1) {
+ if (verbose > 1) {
const char *s = PyUnicode_AsUTF8(key);
if (s != NULL)
PySys_WriteStderr("# clear[1] %s\n", s);
@@ -617,7 +619,7 @@ _PyModule_ClearDict(PyObject *d)
if (PyUnicode_READ_CHAR(key, 0) != '_' ||
!_PyUnicode_EqualToASCIIString(key, "__builtins__"))
{
- if (Py_VerboseFlag > 1) {
+ if (verbose > 1) {
const char *s = PyUnicode_AsUTF8(key);
if (s != NULL)
PySys_WriteStderr("# clear[2] %s\n", s);
@@ -675,8 +677,10 @@ module___init___impl(PyModuleObject *self, PyObject *name, PyObject *doc)
static void
module_dealloc(PyModuleObject *m)
{
+ int verbose = _PyInterpreterState_GET_UNSAFE()->core_config.verbose;
+
PyObject_GC_UnTrack(m);
- if (Py_VerboseFlag && m->md_name) {
+ if (verbose && m->md_name) {
PySys_FormatStderr("# destroy %S\n", m->md_name);
}
if (m->md_weaklist != NULL)