cpython: d5cda62d0f8c (original) (raw)
--- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9132,10 +9132,15 @@ PyUnicode_Count(PyObject *str, Py_ssize_t len1, len2; str_obj = PyUnicode_FromObject(str);
- if (!sub_obj) {
Py_DECREF(str_obj);[](#l1.13)
return -1;[](#l1.14)
- }
- if (PyUnicode_READY(substr) == -1 || PyUnicode_READY(str_obj) == -1) {
} @@ -9215,10 +9220,15 @@ PyUnicode_Find(PyObject *str, Py_ssize_t result; str = PyUnicode_FromObject(str);Py_DECREF(substr);[](#l1.17) Py_DECREF(str_obj);[](#l1.18) return -1;[](#l1.19)
- if (!sub) {
Py_DECREF(str);[](#l1.31)
return -2;[](#l1.32)
- }
- if (PyUnicode_READY(sub) == -1 || PyUnicode_READY(str) == -1) {
} @@ -9857,8 +9867,12 @@ PyUnicode_Splitlines(PyObject *string, i PyObject *list; string = PyUnicode_FromObject(string);Py_DECREF(sub);[](#l1.35) Py_DECREF(str);[](#l1.36) return -2;[](#l1.37)
- if (string == NULL)
return NULL;[](#l1.46)
- if (PyUnicode_READY(string) == -1) {
Py_DECREF(string);[](#l1.48)
return NULL;[](#l1.49)
- }
switch (PyUnicode_KIND(string)) { case PyUnicode_1BYTE_KIND: @@ -10650,14 +10664,16 @@ PyUnicode_Contains(PyObject *container, element->ob_type->tp_name); return -1; }
str = PyUnicode_FromObject(container);
- if (!str) { Py_DECREF(sub); return -1; }
- if (PyUnicode_READY(sub) == -1 || PyUnicode_READY(str) == -1) {
Py_DECREF(sub);[](#l1.68)
Py_DECREF(str);[](#l1.69)
- }
kind1 = PyUnicode_KIND(str); kind2 = PyUnicode_KIND(sub); @@ -11936,20 +11952,25 @@ PyUnicode_Replace(PyObject *obj, PyObject *result; self = PyUnicode_FromObject(obj);
- if (PyUnicode_READY(self) == -1 ||
PyUnicode_READY(str1) == -1 ||[](#l1.96)
PyUnicode_READY(str2) == -1)[](#l1.97)
result = NULL;[](#l1.98)
- else
Py_DECREF(self); Py_DECREF(str1); Py_DECREF(str2); @@ -11973,18 +11994,20 @@ unicode_replace(PyObject *self, PyObject if (!PyArg_ParseTuple(args, "OO|n:replace", &str1, &str2, &maxcount)) return NULL;result = replace(self, str1, str2, maxcount);[](#l1.100)
- if (PyUnicode_READY(str1) == -1 || PyUnicode_READY(str2) == -1)
result = NULL;[](#l1.124)
- else
result = replace(self, str1, str2, maxcount);[](#l1.126)
Py_DECREF(str1); Py_DECREF(str2); @@ -12299,10 +12322,15 @@ PyUnicode_Partition(PyObject *str_in, Py Py_ssize_t len1, len2; str_obj = PyUnicode_FromObject(str_in);
- if (!sep_obj) {
Py_DECREF(str_obj);[](#l1.140)
return NULL;[](#l1.141)
- }
- if (PyUnicode_READY(sep_obj) == -1 || PyUnicode_READY(str_obj) == -1) {
} @@ -13227,8 +13255,10 @@ PyUnicode_Format(PyObject *format, PyObj return NULL; } uformat = PyUnicode_FromObject(format);Py_DECREF(sep_obj);[](#l1.144) Py_DECREF(str_obj);[](#l1.145) return NULL;[](#l1.146)
- if (uformat == NULL)
return NULL;[](#l1.155)
- if (PyUnicode_READY(uformat) == -1)
if (_PyAccu_Init(&acc)) goto onError; fmt = PyUnicode_DATA(uformat); @@ -13729,8 +13759,10 @@ unicode_subtype_new(PyTypeObject *type, if (unicode == NULL) return NULL; assert(_PyUnicode_CHECK(unicode));Py_DECREF(uformat);[](#l1.157)