diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-13 01:04:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-13 01:04:28 (GMT) |
commit | da7933ecc30e37b119756cb02b89a6ad99db22e0 (patch) | |
tree | e6c7227f2ded7b7354fb027342fa977f70808d10 /Objects/bytearrayobject.c | |
parent | 14d5331eb5e6c38be12bad421bd59ad0fac9e448 (diff) | |
download | cpython-da7933ecc30e37b119756cb02b89a6ad99db22e0.zip cpython-da7933ecc30e37b119756cb02b89a6ad99db22e0.tar.gz cpython-da7933ecc30e37b119756cb02b89a6ad99db22e0.tar.bz2 |
bpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492)
Don't access PyInterpreterState.config member directly anymore, but
use new functions:
* _PyInterpreterState_GetConfig()
* _PyInterpreterState_SetConfig()
* _Py_GetConfig()
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r-- | Objects/bytearrayobject.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 7ebfa1f..4d1ddec 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -6,7 +6,6 @@ #include "pycore_bytes_methods.h" #include "pycore_object.h" #include "pycore_pymem.h" -#include "pycore_pystate.h" #include "structmember.h" #include "bytesobject.h" #include "pystrhex.h" @@ -997,8 +996,7 @@ bytearray_repr(PyByteArrayObject *self) static PyObject * bytearray_str(PyObject *op) { - PyConfig *config = &_PyInterpreterState_GET_UNSAFE()->config; - if (config->bytes_warning) { + if (_Py_GetConfig()->bytes_warning) { if (PyErr_WarnEx(PyExc_BytesWarning, "str() on a bytearray instance", 1)) { return NULL; @@ -1023,8 +1021,7 @@ bytearray_richcompare(PyObject *self, PyObject *other, int op) if (rc < 0) return NULL; if (rc) { - PyConfig *config = &_PyInterpreterState_GET_UNSAFE()->config; - if (config->bytes_warning && (op == Py_EQ || op == Py_NE)) { + if (_Py_GetConfig()->bytes_warning && (op == Py_EQ || op == Py_NE)) { if (PyErr_WarnEx(PyExc_BytesWarning, "Comparison between bytearray and string", 1)) return NULL; |