[Python-checkins] cpython: Issue #16286: remove duplicated identity check from unicode_compare()
victor.stinner
python-checkins at python.org
Mon Nov 4 11:29:11 CET 2013
http://hg.python.org/cpython/rev/da9c6e4ef301
changeset: 86919:da9c6e4ef301
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Nov 04 11:27:14 2013 +0100
summary:
Issue #16286: remove duplicated identity check from unicode_compare()
Move the test to PyUnicode_Compare()
files:
Objects/unicodeobject.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -10428,10 +10428,6 @@
void *data1, *data2;
Py_ssize_t len1, len2, len;
- /* a string is equal to itself */
- if (str1 == str2)
- return 0;
-
kind1 = PyUnicode_KIND(str1);
kind2 = PyUnicode_KIND(str2);
data1 = PyUnicode_DATA(str1);
@@ -10555,6 +10551,11 @@
if (PyUnicode_READY(left) == -1 ||
PyUnicode_READY(right) == -1)
return -1;
+
+ /* a string is equal to itself */
+ if (left == right)
+ return 0;
+
return unicode_compare(left, right);
}
PyErr_Format(PyExc_TypeError,
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list