]> granicus.if.org Git - python/commitdiff
Remove all other uses of the C tolower()/toupper() which could break with a Turkish...
authorAntoine Pitrou <solipsis@pitrou.net>
Tue, 4 Oct 2011 11:55:37 +0000 (13:55 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Tue, 4 Oct 2011 11:55:37 +0000 (13:55 +0200)
(except in the strop module, which is deprecated anyway)

Modules/_tkinter.c
Modules/binascii.c
Modules/unicodedata.c

index 01d628435a086f580af979bd4fc3dd7578d04d30..40c8be2ce7cba028c85c46b0c99bc2dd4be3e889 100644 (file)
@@ -663,8 +663,8 @@ Tkapp_New(char *screenName, char *baseName, char *className,
     }
 
     strcpy(argv0, className);
-    if (isupper(Py_CHARMASK(argv0[0])))
-        argv0[0] = tolower(Py_CHARMASK(argv0[0]));
+    if (Py_ISUPPER(Py_CHARMASK(argv0[0])))
+        argv0[0] = Py_TOLOWER(Py_CHARMASK(argv0[0]));
     Tcl_SetVar(v->interp, "argv0", argv0, TCL_GLOBAL_ONLY);
     ckfree(argv0);
 
index 2d91b7f1428eef420fe280e92b1ca6b5f814c388..8334fe5c07c2f67aef071e8c319ed5ba337face0 100644 (file)
@@ -1105,8 +1105,8 @@ to_int(int c)
     if (isdigit(c))
         return c - '0';
     else {
-        if (isupper(c))
-            c = tolower(c);
+        if (Py_ISUPPER(c))
+            c = Py_TOLOWER(c);
         if (c >= 'a' && c <= 'f')
             return c - 'a' + 10;
     }
index e39a4d668d657de8e01f8c31a9b7d2dab512de0d..1445a9521085998e2f0c8d917029621c0b7997e5 100644 (file)
@@ -830,7 +830,7 @@ _gethash(const char *s, int len, int scale)
     unsigned long h = 0;
     unsigned long ix;
     for (i = 0; i < len; i++) {
-        h = (h * scale) + (unsigned char) toupper(Py_CHARMASK(s[i]));
+        h = (h * scale) + (unsigned char) Py_TOUPPER(Py_CHARMASK(s[i]));
         ix = h & 0xff000000;
         if (ix)
             h = (h ^ ((ix>>24) & 0xff)) & 0x00ffffff;
@@ -978,7 +978,7 @@ _cmpname(PyObject *self, int code, const char* name, int namelen)
     if (!_getucname(self, code, buffer, sizeof(buffer)))
         return 0;
     for (i = 0; i < namelen; i++) {
-        if (toupper(Py_CHARMASK(name[i])) != buffer[i])
+        if (Py_TOUPPER(Py_CHARMASK(name[i])) != buffer[i])
             return 0;
     }
     return buffer[namelen] == '\0';