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

@ -998,7 +998,8 @@ bytearray_repr(PyByteArrayObject *self)
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 @@ bytearray_richcompare(PyObject *self, PyObject *other, int op)
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;