mirror of
https://github.com/python/cpython.git
synced 2025-08-24 10:45:53 +00:00
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:
parent
3c93153f7d
commit
c96be811fa
9 changed files with 51 additions and 37 deletions
|
@ -1421,7 +1421,8 @@ bytes_repr(PyObject *op)
|
|||
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 @@ bytes_richcompare(PyBytesObject *a, PyBytesObject *b, int op)
|
|||
|
||||
/* 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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue