This commit is contained in:
Antoine Pitrou 2012-05-12 19:02:47 +02:00
commit 04b2e69e67
1 changed files with 10 additions and 4 deletions

View File

@ -9075,12 +9075,15 @@ PyUnicode_Count(PyObject *str,
kind1 = PyUnicode_KIND(str_obj);
kind2 = PyUnicode_KIND(sub_obj);
kind = kind2;
kind = kind1;
buf1 = PyUnicode_DATA(str_obj);
buf2 = PyUnicode_DATA(sub_obj);
if (kind2 != kind) {
if (kind2 > kind)
return 0;
if (kind2 > kind) {
Py_DECREF(sub_obj);
Py_DECREF(str_obj);
return 0;
}
buf2 = _PyUnicode_AsKind(sub_obj, kind);
}
if (!buf2)
@ -10659,8 +10662,11 @@ PyUnicode_Contains(PyObject *container, PyObject *element)
buf1 = PyUnicode_DATA(str);
buf2 = PyUnicode_DATA(sub);
if (kind2 != kind) {
if (kind2 > kind)
if (kind2 > kind) {
Py_DECREF(sub);
Py_DECREF(str);
return 0;
}
buf2 = _PyUnicode_AsKind(sub, kind);
}
if (!buf2) {