Mercurial > cpython-lru_cache-weakref
diff Objects/bytes_methods.c @ 74301:9683d59170ee
Issue #13738: Simplify implementation of bytes.lower() and bytes.upper().
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sun, 08 Jan 2012 16:22:46 +0100 |
| parents | 586745894ab8 |
| children | e7f6cef7a4cc |
line wrap: on
line diff
--- a/Objects/bytes_methods.c Sun Jan 08 08:42:03 2012 +0200 +++ b/Objects/bytes_methods.c Sun Jan 08 16:22:46 2012 +0100 @@ -248,12 +248,8 @@ { Py_ssize_t i; - Py_MEMCPY(result, cptr, len); - for (i = 0; i < len; i++) { - int c = Py_CHARMASK(result[i]); - if (Py_ISUPPER(c)) - result[i] = Py_TOLOWER(c); + result[i] = Py_TOLOWER((unsigned char) cptr[i]); } } @@ -268,12 +264,8 @@ { Py_ssize_t i; - Py_MEMCPY(result, cptr, len); - for (i = 0; i < len; i++) { - int c = Py_CHARMASK(result[i]); - if (Py_ISLOWER(c)) - result[i] = Py_TOUPPER(c); + result[i] = Py_TOUPPER((unsigned char) cptr[i]); } }
