#12266: Fix str.capitalize() to correctly uppercase/lowercase titlecased and cased non-letter characters.

This commit is contained in:
Ezio Melotti 2011-08-15 09:22:24 +03:00
parent ca5e908c6e
commit 15d6b65ead
3 changed files with 22 additions and 2 deletions

View file

@ -5485,13 +5485,13 @@ int fixcapitalize(PyUnicodeObject *self)
if (len == 0)
return 0;
if (Py_UNICODE_ISLOWER(*s)) {
if (!Py_UNICODE_ISUPPER(*s)) {
*s = Py_UNICODE_TOUPPER(*s);
status = 1;
}
s++;
while (--len > 0) {
if (Py_UNICODE_ISUPPER(*s)) {
if (!Py_UNICODE_ISLOWER(*s)) {
*s = Py_UNICODE_TOLOWER(*s);
status = 1;
}