mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
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()
This commit is contained in:
parent
14d5331eb5
commit
da7933ecc3
19 changed files with 90 additions and 64 deletions
|
|
@ -7,7 +7,6 @@
|
|||
#include "pycore_bytes_methods.h"
|
||||
#include "pycore_object.h"
|
||||
#include "pycore_pymem.h"
|
||||
#include "pycore_pystate.h"
|
||||
|
||||
#include "pystrhex.h"
|
||||
#include <stddef.h>
|
||||
|
|
@ -1342,8 +1341,7 @@ bytes_repr(PyObject *op)
|
|||
static PyObject *
|
||||
bytes_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 bytes instance", 1)) {
|
||||
return NULL;
|
||||
|
|
@ -1500,8 +1498,7 @@ bytes_richcompare(PyBytesObject *a, PyBytesObject *b, int op)
|
|||
|
||||
/* Make sure both arguments are strings. */
|
||||
if (!(PyBytes_Check(a) && PyBytes_Check(b))) {
|
||||
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)) {
|
||||
rc = PyObject_IsInstance((PyObject*)a,
|
||||
(PyObject*)&PyUnicode_Type);
|
||||
if (!rc)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue