[Python-checkins] cpython: Issue #13738: Simplify implementation of bytes.lower() and bytes.upper().
antoine.pitrou
python-checkins at python.org
Sun Jan 8 16:44:55 CET 2012
http://hg.python.org/cpython/rev/9683d59170ee
changeset: 74301:9683d59170ee
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sun Jan 08 16:22:46 2012 +0100
summary:
Issue #13738: Simplify implementation of bytes.lower() and bytes.upper().
files:
Misc/NEWS | 2 ++
Objects/bytes_methods.c | 12 ++----------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,8 @@
Core and Builtins
-----------------
+- Issue #13738: Simplify implementation of bytes.lower() and bytes.upper().
+
- Issue #13577: Built-in methods and functions now have a __qualname__.
Patch by sbt.
diff --git a/Objects/bytes_methods.c b/Objects/bytes_methods.c
--- a/Objects/bytes_methods.c
+++ b/Objects/bytes_methods.c
@@ -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]);
}
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list