| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -266,7 +266,6 @@ _set_char_or_none(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt | |||
| 266 | 266 | name); | |
| 267 | 267 | return -1; | |
| 268 | 268 | } | |
| 269 | - /* PyUnicode_READY() is called in PyUnicode_GetLength() */ | ||
| 270 | 269 | *target = PyUnicode_READ_CHAR(src, 0); | |
| 271 | 270 | } | |
| 272 | 271 | } | |
@@ -296,7 +295,6 @@ _set_char(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt) | |||
| 296 | 295 | name); | |
| 297 | 296 | return -1; | |
| 298 | 297 | } | |
| 299 | - /* PyUnicode_READY() is called in PyUnicode_GetLength() */ | ||
| 300 | 298 | *target = PyUnicode_READ_CHAR(src, 0); | |
| 301 | 299 | } | |
| 302 | 300 | return 0; | |
@@ -316,8 +314,6 @@ _set_str(const char *name, PyObject **target, PyObject *src, const char *dflt) | |||
| 316 | 314 | return -1; | |
| 317 | 315 | } | |
| 318 | 316 | else { | |
| 319 | - if (PyUnicode_READY(src) == -1) | ||
| 320 | - return -1; | ||
| 321 | 317 | Py_XSETREF(*target, Py_NewRef(src)); | |
| 322 | 318 | } | |
| 323 | 319 | } | |
@@ -904,10 +900,6 @@ Reader_iternext(ReaderObj *self) | |||
| 904 | 900 | Py_DECREF(lineobj); | |
| 905 | 901 | return NULL; | |
| 906 | 902 | } | |
| 907 | - if (PyUnicode_READY(lineobj) == -1) { | ||
| 908 | - Py_DECREF(lineobj); | ||
| 909 | - return NULL; | ||
| 910 | - } | ||
| 911 | 903 | ++self->line_num; | |
| 912 | 904 | kind = PyUnicode_KIND(lineobj); | |
| 913 | 905 | data = PyUnicode_DATA(lineobj); | |
@@ -1185,8 +1177,6 @@ join_append(WriterObj *self, PyObject *field, int quoted) | |||
| 1185 | 1177 | Py_ssize_t rec_len; | |
| 1186 | 1178 | ||
| 1187 | 1179 | if (field != NULL) { | |
| 1188 | - if (PyUnicode_READY(field) == -1) | ||
| 1189 | - return 0; | ||
| 1190 | 1180 | field_kind = PyUnicode_KIND(field); | |
| 1191 | 1181 | field_data = PyUnicode_DATA(field); | |
| 1192 | 1182 | field_len = PyUnicode_GET_LENGTH(field); | |
@@ -1515,8 +1505,6 @@ csv_register_dialect(PyObject *module, PyObject *args, PyObject *kwargs) | |||
| 1515 | 1505 | "dialect name must be a string"); | |
| 1516 | 1506 | return NULL; | |
| 1517 | 1507 | } | |
| 1518 | - if (PyUnicode_READY(name_obj) == -1) | ||
| 1519 | - return NULL; | ||
| 1520 | 1508 | dialect = _call_dialect(module_state, dialect_obj, kwargs); | |
| 1521 | 1509 | if (dialect == NULL) | |
| 1522 | 1510 | return NULL; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2901,9 +2901,6 @@ date_new(PyTypeObject *type, PyObject *args, PyObject *kw) | |||
| 2901 | 2901 | } | |
| 2902 | 2902 | } | |
| 2903 | 2903 | else if (PyUnicode_Check(state)) { | |
| 2904 | - if (PyUnicode_READY(state)) { | ||
| 2905 | - return NULL; | ||
| 2906 | - } | ||
| 2907 | 2904 | if (PyUnicode_GET_LENGTH(state) == _PyDateTime_DATE_DATASIZE && | |
| 2908 | 2905 | MONTH_IS_SANE(PyUnicode_READ_CHAR(state, 2))) | |
| 2909 | 2906 | { | |
@@ -4234,9 +4231,6 @@ time_new(PyTypeObject *type, PyObject *args, PyObject *kw) | |||
| 4234 | 4231 | } | |
| 4235 | 4232 | } | |
| 4236 | 4233 | else if (PyUnicode_Check(state)) { | |
| 4237 | - if (PyUnicode_READY(state)) { | ||
| 4238 | - return NULL; | ||
| 4239 | - } | ||
| 4240 | 4234 | if (PyUnicode_GET_LENGTH(state) == _PyDateTime_TIME_DATASIZE && | |
| 4241 | 4235 | (0x7F & PyUnicode_READ_CHAR(state, 0)) < 24) | |
| 4242 | 4236 | { | |
@@ -4909,9 +4903,6 @@ datetime_new(PyTypeObject *type, PyObject *args, PyObject *kw) | |||
| 4909 | 4903 | } | |
| 4910 | 4904 | } | |
| 4911 | 4905 | else if (PyUnicode_Check(state)) { | |
| 4912 | - if (PyUnicode_READY(state)) { | ||
| 4913 | - return NULL; | ||
| 4914 | - } | ||
| 4915 | 4906 | if (PyUnicode_GET_LENGTH(state) == _PyDateTime_DATETIME_DATASIZE && | |
| 4916 | 4907 | MONTH_IS_SANE(PyUnicode_READ_CHAR(state, 2) & 0x7F)) | |
| 4917 | 4908 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1934,10 +1934,6 @@ numeric_as_ascii(PyObject *u, int strip_ws, int ignore_underscores) | |||
| 1934 | 1934 | Py_ssize_t j, len; | |
| 1935 | 1935 | int d; | |
| 1936 | 1936 | ||
| 1937 | - if (PyUnicode_READY(u) == -1) { | ||
| 1938 | - return NULL; | ||
| 1939 | - } | ||
| 1940 | - | ||
| 1941 | 1937 | kind = PyUnicode_KIND(u); | |
| 1942 | 1938 | data = PyUnicode_DATA(u); | |
| 1943 | 1939 | len = PyUnicode_GET_LENGTH(u); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1448,8 +1448,6 @@ _elementtree_Element_iter_impl(ElementObject *self, PyTypeObject *cls, | |||
| 1448 | 1448 | /*[clinic end generated code: output=bff29dc5d4566c68 input=f6944c48d3f84c58]*/ | |
| 1449 | 1449 | { | |
| 1450 | 1450 | if (PyUnicode_Check(tag)) { | |
| 1451 | - if (PyUnicode_READY(tag) < 0) | ||
| 1452 | - return NULL; | ||
| 1453 | 1451 | if (PyUnicode_GET_LENGTH(tag) == 1 && PyUnicode_READ_CHAR(tag, 0) == '*') | |
| 1454 | 1452 | tag = Py_None; | |
| 1455 | 1453 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1988,9 +1988,6 @@ _hashlib_compare_digest_impl(PyObject *module, PyObject *a, PyObject *b) | |||
| 1988 | 1988 | ||
| 1989 | 1989 | /* ASCII unicode string */ | |
| 1990 | 1990 | if(PyUnicode_Check(a) && PyUnicode_Check(b)) { | |
| 1991 | - if (PyUnicode_READY(a) == -1 || PyUnicode_READY(b) == -1) { | ||
| 1992 | - return NULL; | ||
| 1993 | - } | ||
| 1994 | 1991 | if (!PyUnicode_IS_ASCII(a) || !PyUnicode_IS_ASCII(b)) { | |
| 1995 | 1992 | PyErr_SetString(PyExc_TypeError, | |
| 1996 | 1993 | "comparing strings with non-ASCII characters is " | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -200,10 +200,6 @@ write_str(stringio *self, PyObject *obj) | |||
| 200 | 200 | return -1; | |
| 201 | 201 | ||
| 202 | 202 | assert(PyUnicode_Check(decoded)); | |
| 203 | - if (PyUnicode_READY(decoded)) { | ||
| 204 | - Py_DECREF(decoded); | ||
| 205 | - return -1; | ||
| 206 | - } | ||
| 207 | 203 | len = PyUnicode_GET_LENGTH(decoded); | |
| 208 | 204 | assert(len >= 0); | |
| 209 | 205 | ||
@@ -542,8 +538,6 @@ _io_StringIO_write(stringio *self, PyObject *obj) | |||
| 542 | 538 | Py_TYPE(obj)->tp_name); | |
| 543 | 539 | return NULL; | |
| 544 | 540 | } | |
| 545 | - if (PyUnicode_READY(obj)) | ||
| 546 | - return NULL; | ||
| 547 | 541 | CHECK_CLOSED(self); | |
| 548 | 542 | size = PyUnicode_GET_LENGTH(obj); | |
| 549 | 543 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -288,10 +288,6 @@ check_decoded(PyObject *decoded) | |||
| 288 | 288 | Py_DECREF(decoded); | |
| 289 | 289 | return -1; | |
| 290 | 290 | } | |
| 291 | - if (PyUnicode_READY(decoded) < 0) { | ||
| 292 | - Py_DECREF(decoded); | ||
| 293 | - return -1; | ||
| 294 | - } | ||
| 295 | 291 | return 0; | |
| 296 | 292 | } | |
| 297 | 293 | ||
@@ -1611,9 +1607,6 @@ _io_TextIOWrapper_write_impl(textio *self, PyObject *text) | |||
| 1611 | 1607 | int haslf = 0; | |
| 1612 | 1608 | int needflush = 0, text_needflush = 0; | |
| 1613 | 1609 | ||
| 1614 | - if (PyUnicode_READY(text) == -1) | ||
| 1615 | - return NULL; | ||
| 1616 | - | ||
| 1617 | 1610 | CHECK_ATTACHED(self); | |
| 1618 | 1611 | CHECK_CLOSED(self); | |
| 1619 | 1612 | ||
@@ -1972,8 +1965,6 @@ _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n) | |||
| 1972 | 1965 | result = textiowrapper_get_decoded_chars(self, n); | |
| 1973 | 1966 | if (result == NULL) | |
| 1974 | 1967 | goto fail; | |
| 1975 | - if (PyUnicode_READY(result) == -1) | ||
| 1976 | - goto fail; | ||
| 1977 | 1968 | remaining -= PyUnicode_GET_LENGTH(result); | |
| 1978 | 1969 | ||
| 1979 | 1970 | /* Keep reading chunks until we have n characters to return */ | |
@@ -2185,8 +2176,6 @@ _textiowrapper_readline(textio *self, Py_ssize_t limit) | |||
| 2185 | 2176 | Py_CLEAR(remaining); | |
| 2186 | 2177 | if (line == NULL) | |
| 2187 | 2178 | goto error; | |
| 2188 | - if (PyUnicode_READY(line) == -1) | ||
| 2189 | - goto error; | ||
| 2190 | 2179 | } | |
| 2191 | 2180 | ||
| 2192 | 2181 | ptr = PyUnicode_DATA(line); | |
@@ -3106,7 +3095,7 @@ textiowrapper_iternext(textio *self) | |||
| 3106 | 3095 | } | |
| 3107 | 3096 | } | |
| 3108 | 3097 | ||
| 3109 | - if (line == NULL || PyUnicode_READY(line) == -1) | ||
| 3098 | + if (line == NULL) | ||
| 3110 | 3099 | return NULL; | |
| 3111 | 3100 | ||
| 3112 | 3101 | if (PyUnicode_GET_LENGTH(line) == 0) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -152,9 +152,6 @@ ascii_escape_unicode(PyObject *pystr) | |||
| 152 | 152 | Py_UCS1 *output; | |
| 153 | 153 | int kind; | |
| 154 | 154 | ||
| 155 | - if (PyUnicode_READY(pystr) == -1) | ||
| 156 | - return NULL; | ||
| 157 | - | ||
| 158 | 155 | input_chars = PyUnicode_GET_LENGTH(pystr); | |
| 159 | 156 | input = PyUnicode_DATA(pystr); | |
| 160 | 157 | kind = PyUnicode_KIND(pystr); | |
@@ -218,9 +215,6 @@ escape_unicode(PyObject *pystr) | |||
| 218 | 215 | int kind; | |
| 219 | 216 | Py_UCS4 maxchar; | |
| 220 | 217 | ||
| 221 | - if (PyUnicode_READY(pystr) == -1) | ||
| 222 | - return NULL; | ||
| 223 | - | ||
| 224 | 218 | maxchar = PyUnicode_MAX_CHAR_VALUE(pystr); | |
| 225 | 219 | input_chars = PyUnicode_GET_LENGTH(pystr); | |
| 226 | 220 | input = PyUnicode_DATA(pystr); | |
@@ -377,9 +371,6 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict, Py_ssize_t *next | |||
| 377 | 371 | const void *buf; | |
| 378 | 372 | int kind; | |
| 379 | 373 | ||
| 380 | - if (PyUnicode_READY(pystr) == -1) | ||
| 381 | - return 0; | ||
| 382 | - | ||
| 383 | 374 | _PyUnicodeWriter writer; | |
| 384 | 375 | _PyUnicodeWriter_Init(&writer); | |
| 385 | 376 | writer.overallocate = 1; | |
@@ -675,9 +666,6 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss | |||
| 675 | 666 | int has_pairs_hook = (s->object_pairs_hook != Py_None); | |
| 676 | 667 | Py_ssize_t next_idx; | |
| 677 | 668 | ||
| 678 | - if (PyUnicode_READY(pystr) == -1) | ||
| 679 | - return NULL; | ||
| 680 | - | ||
| 681 | 669 | str = PyUnicode_DATA(pystr); | |
| 682 | 670 | kind = PyUnicode_KIND(pystr); | |
| 683 | 671 | end_idx = PyUnicode_GET_LENGTH(pystr) - 1; | |
@@ -801,9 +789,6 @@ _parse_array_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssi | |||
| 801 | 789 | PyObject *rval; | |
| 802 | 790 | Py_ssize_t next_idx; | |
| 803 | 791 | ||
| 804 | - if (PyUnicode_READY(pystr) == -1) | ||
| 805 | - return NULL; | ||
| 806 | - | ||
| 807 | 792 | rval = PyList_New(0); | |
| 808 | 793 | if (rval == NULL) | |
| 809 | 794 | return NULL; | |
@@ -906,9 +891,6 @@ _match_number_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_ | |||
| 906 | 891 | PyObject *numstr = NULL; | |
| 907 | 892 | PyObject *custom_func; | |
| 908 | 893 | ||
| 909 | - if (PyUnicode_READY(pystr) == -1) | ||
| 910 | - return NULL; | ||
| 911 | - | ||
| 912 | 894 | str = PyUnicode_DATA(pystr); | |
| 913 | 895 | kind = PyUnicode_KIND(pystr); | |
| 914 | 896 | end_idx = PyUnicode_GET_LENGTH(pystr) - 1; | |
@@ -1018,9 +1000,6 @@ scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_ | |||
| 1018 | 1000 | int kind; | |
| 1019 | 1001 | Py_ssize_t length; | |
| 1020 | 1002 | ||
| 1021 | - if (PyUnicode_READY(pystr) == -1) | ||
| 1022 | - return NULL; | ||
| 1023 | - | ||
| 1024 | 1003 | str = PyUnicode_DATA(pystr); | |
| 1025 | 1004 | kind = PyUnicode_KIND(pystr); | |
| 1026 | 1005 | length = PyUnicode_GET_LENGTH(pystr); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -823,9 +823,6 @@ _operator__compare_digest_impl(PyObject *module, PyObject *a, PyObject *b) | |||
| 823 | 823 | ||
| 824 | 824 | /* ASCII unicode string */ | |
| 825 | 825 | if(PyUnicode_Check(a) && PyUnicode_Check(b)) { | |
| 826 | - if (PyUnicode_READY(a) == -1 || PyUnicode_READY(b) == -1) { | ||
| 827 | - return NULL; | ||
| 828 | - } | ||
| 829 | 826 | if (!PyUnicode_IS_ASCII(a) || !PyUnicode_IS_ASCII(b)) { | |
| 830 | 827 | PyErr_SetString(PyExc_TypeError, | |
| 831 | 828 | "comparing strings with non-ASCII characters is " | |
@@ -1234,10 +1231,6 @@ attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) | |||
| 1234 | 1231 | Py_DECREF(attr); | |
| 1235 | 1232 | return NULL; | |
| 1236 | 1233 | } | |
| 1237 | - if (PyUnicode_READY(item)) { | ||
| 1238 | - Py_DECREF(attr); | ||
| 1239 | - return NULL; | ||
| 1240 | - } | ||
| 1241 | 1234 | Py_ssize_t item_len = PyUnicode_GET_LENGTH(item); | |
| 1242 | 1235 | int kind = PyUnicode_KIND(item); | |
| 1243 | 1236 | const void *data = PyUnicode_DATA(item); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2602,9 +2602,6 @@ raw_unicode_escape(PyObject *obj) | |||
| 2602 | 2602 | int kind; | |
| 2603 | 2603 | _PyBytesWriter writer; | |
| 2604 | 2604 | ||
| 2605 | - if (PyUnicode_READY(obj)) | ||
| 2606 | - return NULL; | ||
| 2607 | - | ||
| 2608 | 2605 | _PyBytesWriter_Init(&writer); | |
| 2609 | 2606 | ||
| 2610 | 2607 | size = PyUnicode_GET_LENGTH(obj); | |
@@ -2674,9 +2671,6 @@ write_unicode_binary(PicklerObject *self, PyObject *obj) | |||
| 2674 | 2671 | Py_ssize_t size; | |
| 2675 | 2672 | const char *data; | |
| 2676 | 2673 | ||
| 2677 | - if (PyUnicode_READY(obj)) | ||
| 2678 | - return -1; | ||
| 2679 | - | ||
| 2680 | 2674 | data = PyUnicode_AsUTF8AndSize(obj, &size); | |
| 2681 | 2675 | if (data == NULL) { | |
| 2682 | 2676 | /* Issue #8383: for strings with lone surrogates, fallback on the | |
| Back | FazBrowse Home | New Git URL |
0 commit comments