diff options
author | Victor Stinner <vstinner@python.org> | 2023-06-01 23:33:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-01 23:33:17 (GMT) |
commit | ef300937c2a1b3ebe19c2835f3b46585825c1e1f (patch) | |
tree | 34f151a390fb946ff985ed98e6c1bd096c4d090b /Objects/stringlib | |
parent | cbb9ba844f15f2b8127028e6dfd4681b2cb2376f (diff) | |
download | cpython-ef300937c2a1b3ebe19c2835f3b46585825c1e1f.zip cpython-ef300937c2a1b3ebe19c2835f3b46585825c1e1f.tar.gz cpython-ef300937c2a1b3ebe19c2835f3b46585825c1e1f.tar.bz2 |
gh-92536: Remove PyUnicode_READY() calls (#105210)
Since Python 3.12, PyUnicode_READY() does nothing and always
returns 0.
Diffstat (limited to 'Objects/stringlib')
-rw-r--r-- | Objects/stringlib/codecs.h | 3 | ||||
-rw-r--r-- | Objects/stringlib/unicode_format.h | 14 |
2 files changed, 2 insertions, 15 deletions
diff --git a/Objects/stringlib/codecs.h b/Objects/stringlib/codecs.h index 958cc86..f98e71c 100644 --- a/Objects/stringlib/codecs.h +++ b/Objects/stringlib/codecs.h @@ -408,9 +408,6 @@ STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, } else { /* rep is unicode */ - if (PyUnicode_READY(rep) < 0) - goto error; - if (!PyUnicode_IS_ASCII(rep)) { raise_encode_exception(&exc, "utf-8", unicode, startpos, endpos, diff --git a/Objects/stringlib/unicode_format.h b/Objects/stringlib/unicode_format.h index ccd7c77..f4ba0a9 100644 --- a/Objects/stringlib/unicode_format.h +++ b/Objects/stringlib/unicode_format.h @@ -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; |