summaryrefslogtreecommitdiffstats
path: root/Objects/bytearrayobject.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/bytearrayobject.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/bytearrayobject.c')
-rw-r--r--Objects/bytearrayobject.c6
1 files changed, 4 insertions, 2 deletions
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 @@ 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;