summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-04-27 20:26:58 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-04-27 20:26:58 (GMT)
commit94d558b063d63eda7a898ab31b0bc2e4d0294bf1 (patch)
treedc52f9dae1317e1cced94e41dedae69d4ee99855 /Objects
parentfea73efc9ea2a65d73a55f8bab1adfbbca62e38b (diff)
downloadcpython-94d558b063d63eda7a898ab31b0bc2e4d0294bf1.zip
cpython-94d558b063d63eda7a898ab31b0bc2e4d0294bf1.tar.gz
cpython-94d558b063d63eda7a898ab31b0bc2e4d0294bf1.tar.bz2
Optimize _PyUnicode_FindMaxChar() find pure ASCII strings
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 60b0a1f..3afb799 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1985,6 +1985,9 @@ _PyUnicode_FindMaxChar(PyObject *unicode, Py_ssize_t start, Py_ssize_t end)
if (start == end)
return 127;
+ if (PyUnicode_IS_ASCII(unicode))
+ return 127;
+
kind = PyUnicode_KIND(unicode);
startptr = PyUnicode_DATA(unicode);
endptr = (char *)startptr + end * kind;