diff Objects/unicodeobject.c @ 71866:c34772013c53 3.2

#12266: Fix str.capitalize() to correctly uppercase/lowercase titlecased and cased non-letter characters.
author Ezio Melotti <ezio.melotti@gmail.com>
date Mon, 15 Aug 2011 09:09:57 +0300
parents 787ed1a7aba8
children 459e2a9b7f54 1ea72da11724
line wrap: on
line diff
--- a/Objects/unicodeobject.c	Sun Aug 14 08:28:57 2011 +0300
+++ b/Objects/unicodeobject.c	Mon Aug 15 09:09:57 2011 +0300
@@ -6658,13 +6658,13 @@
 
     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;
         }