mirror of
https://github.com/python/cpython.git
synced 2025-08-24 02:35:59 +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
|
@ -820,7 +820,7 @@ output_markup(SubString *field_name, SubString *format_spec,
|
|||
|
||||
if (conversion != '\0') {
|
||||
tmp = do_conversion(fieldobj, conversion);
|
||||
if (tmp == NULL || PyUnicode_READY(tmp) == -1)
|
||||
if (tmp == NULL)
|
||||
goto done;
|
||||
|
||||
/* do the assignment, transferring ownership: fieldobj = tmp */
|
||||
|
@ -832,7 +832,7 @@ output_markup(SubString *field_name, SubString *format_spec,
|
|||
if (format_spec_needs_expanding) {
|
||||
tmp = build_string(format_spec, args, kwargs, recursion_depth-1,
|
||||
auto_number);
|
||||
if (tmp == NULL || PyUnicode_READY(tmp) == -1)
|
||||
if (tmp == NULL)
|
||||
goto done;
|
||||
|
||||
/* note that in the case we're expanding the format string,
|
||||
|
@ -948,10 +948,6 @@ do_string_format(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
int recursion_depth = 2;
|
||||
|
||||
AutoNumber auto_number;
|
||||
|
||||
if (PyUnicode_READY(self) == -1)
|
||||
return NULL;
|
||||
|
||||
AutoNumber_Init(&auto_number);
|
||||
SubString_init(&input, self, 0, PyUnicode_GET_LENGTH(self));
|
||||
return build_string(&input, args, kwargs, recursion_depth, &auto_number);
|
||||
|
@ -1110,9 +1106,6 @@ formatter_parser(PyObject *ignored, PyObject *self)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (PyUnicode_READY(self) == -1)
|
||||
return NULL;
|
||||
|
||||
it = PyObject_New(formatteriterobject, &PyFormatterIter_Type);
|
||||
if (it == NULL)
|
||||
return NULL;
|
||||
|
@ -1252,9 +1245,6 @@ formatter_field_name_split(PyObject *ignored, PyObject *self)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (PyUnicode_READY(self) == -1)
|
||||
return NULL;
|
||||
|
||||
it = PyObject_New(fieldnameiterobject, &PyFieldNameIter_Type);
|
||||
if (it == NULL)
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue