mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-39487: Merge duplicated _Py_IDENTIFIER identifiers in C code (GH-18254)
Moving repetitive `_Py_IDENTIFIER` instances to a global location helps identify them more easily in regards to sub-interpreter support.
This commit is contained in:
parent
c232c9110c
commit
46874c26ee
12 changed files with 24 additions and 34 deletions
|
@ -25,6 +25,8 @@ Py_ssize_t _Py_null_strings, _Py_one_strings;
|
|||
static PyBytesObject *characters[UCHAR_MAX + 1];
|
||||
static PyBytesObject *nullstring;
|
||||
|
||||
_Py_IDENTIFIER(__bytes__);
|
||||
|
||||
/* PyBytesObject_SIZE gives the basic size of a string; any memory allocation
|
||||
for a string of length n should request PyBytesObject_SIZE + n bytes.
|
||||
|
||||
|
@ -543,7 +545,6 @@ static PyObject *
|
|||
format_obj(PyObject *v, const char **pbuf, Py_ssize_t *plen)
|
||||
{
|
||||
PyObject *func, *result;
|
||||
_Py_IDENTIFIER(__bytes__);
|
||||
/* is it a bytes object? */
|
||||
if (PyBytes_Check(v)) {
|
||||
*pbuf = PyBytes_AS_STRING(v);
|
||||
|
@ -2485,7 +2486,6 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
PyObject *func;
|
||||
Py_ssize_t size;
|
||||
static char *kwlist[] = {"source", "encoding", "errors", 0};
|
||||
_Py_IDENTIFIER(__bytes__);
|
||||
|
||||
if (type != &PyBytes_Type)
|
||||
return bytes_subtype_new(type, args, kwds);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue