mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-92536: Remove PyUnicode_READY() calls (#105210)
Since Python 3.12, PyUnicode_READY() does nothing and always returns 0.
This commit is contained in:
parent
cbb9ba844f
commit
ef300937c2
32 changed files with 5 additions and 186 deletions
|
@ -152,9 +152,6 @@ ascii_escape_unicode(PyObject *pystr)
|
|||
Py_UCS1 *output;
|
||||
int kind;
|
||||
|
||||
if (PyUnicode_READY(pystr) == -1)
|
||||
return NULL;
|
||||
|
||||
input_chars = PyUnicode_GET_LENGTH(pystr);
|
||||
input = PyUnicode_DATA(pystr);
|
||||
kind = PyUnicode_KIND(pystr);
|
||||
|
@ -218,9 +215,6 @@ escape_unicode(PyObject *pystr)
|
|||
int kind;
|
||||
Py_UCS4 maxchar;
|
||||
|
||||
if (PyUnicode_READY(pystr) == -1)
|
||||
return NULL;
|
||||
|
||||
maxchar = PyUnicode_MAX_CHAR_VALUE(pystr);
|
||||
input_chars = PyUnicode_GET_LENGTH(pystr);
|
||||
input = PyUnicode_DATA(pystr);
|
||||
|
@ -377,9 +371,6 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict, Py_ssize_t *next
|
|||
const void *buf;
|
||||
int kind;
|
||||
|
||||
if (PyUnicode_READY(pystr) == -1)
|
||||
return 0;
|
||||
|
||||
_PyUnicodeWriter writer;
|
||||
_PyUnicodeWriter_Init(&writer);
|
||||
writer.overallocate = 1;
|
||||
|
@ -675,9 +666,6 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
|
|||
int has_pairs_hook = (s->object_pairs_hook != Py_None);
|
||||
Py_ssize_t next_idx;
|
||||
|
||||
if (PyUnicode_READY(pystr) == -1)
|
||||
return NULL;
|
||||
|
||||
str = PyUnicode_DATA(pystr);
|
||||
kind = PyUnicode_KIND(pystr);
|
||||
end_idx = PyUnicode_GET_LENGTH(pystr) - 1;
|
||||
|
@ -801,9 +789,6 @@ _parse_array_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssi
|
|||
PyObject *rval;
|
||||
Py_ssize_t next_idx;
|
||||
|
||||
if (PyUnicode_READY(pystr) == -1)
|
||||
return NULL;
|
||||
|
||||
rval = PyList_New(0);
|
||||
if (rval == NULL)
|
||||
return NULL;
|
||||
|
@ -906,9 +891,6 @@ _match_number_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_
|
|||
PyObject *numstr = NULL;
|
||||
PyObject *custom_func;
|
||||
|
||||
if (PyUnicode_READY(pystr) == -1)
|
||||
return NULL;
|
||||
|
||||
str = PyUnicode_DATA(pystr);
|
||||
kind = PyUnicode_KIND(pystr);
|
||||
end_idx = PyUnicode_GET_LENGTH(pystr) - 1;
|
||||
|
@ -1018,9 +1000,6 @@ scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_
|
|||
int kind;
|
||||
Py_ssize_t length;
|
||||
|
||||
if (PyUnicode_READY(pystr) == -1)
|
||||
return NULL;
|
||||
|
||||
str = PyUnicode_DATA(pystr);
|
||||
kind = PyUnicode_KIND(pystr);
|
||||
length = PyUnicode_GET_LENGTH(pystr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue