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.
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 6672136..eaf5dce 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -998,7 +998,8 @@
 static PyObject *
 bytearray_str(PyObject *op)
 {
-    if (Py_BytesWarningFlag) {
+    _PyCoreConfig *config = &_PyInterpreterState_GET_UNSAFE()->core_config;
+    if (config->bytes_warning) {
         if (PyErr_WarnEx(PyExc_BytesWarning,
                          "str() on a bytearray instance", 1)) {
                 return NULL;
@@ -1023,7 +1024,8 @@
     if (rc < 0)
         return NULL;
     if (rc) {
-        if (Py_BytesWarningFlag && (op == Py_EQ || op == Py_NE)) {
+        _PyCoreConfig *config = &_PyInterpreterState_GET_UNSAFE()->core_config;
+        if (config->bytes_warning && (op == Py_EQ || op == Py_NE)) {
             if (PyErr_WarnEx(PyExc_BytesWarning,
                             "Comparison between bytearray and string", 1))
                 return NULL;
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 0b46cee..b7c5b75 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -1421,7 +1421,8 @@
 static PyObject *
 bytes_str(PyObject *op)
 {
-    if (Py_BytesWarningFlag) {
+    _PyCoreConfig *config = &_PyInterpreterState_GET_UNSAFE()->core_config;
+    if (config->bytes_warning) {
         if (PyErr_WarnEx(PyExc_BytesWarning,
                          "str() on a bytes instance", 1)) {
             return NULL;
@@ -1578,7 +1579,8 @@
 
     /* Make sure both arguments are strings. */
     if (!(PyBytes_Check(a) && PyBytes_Check(b))) {
-        if (Py_BytesWarningFlag && (op == Py_EQ || op == Py_NE)) {
+        _PyCoreConfig *config = &_PyInterpreterState_GET_UNSAFE()->core_config;
+        if (config->bytes_warning && (op == Py_EQ || op == Py_NE)) {
             rc = PyObject_IsInstance((PyObject*)a,
                                      (PyObject*)&PyUnicode_Type);
             if (!rc)
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 @@
     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 @@
             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 @@
 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)