diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-11-04 10:27:14 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-11-04 10:27:14 (GMT) |
commit | f0c7b2af0552a4810aa4f879ca90b2706350d192 (patch) | |
tree | 67e927de8d174ac5f5cde735753c2de5bd8a2bdc /Objects | |
parent | fd9e44db371f6e097b8756a004ac3783f7fb2df0 (diff) | |
download | cpython-f0c7b2af0552a4810aa4f879ca90b2706350d192.zip cpython-f0c7b2af0552a4810aa4f879ca90b2706350d192.tar.gz cpython-f0c7b2af0552a4810aa4f879ca90b2706350d192.tar.bz2 |
Issue #16286: remove duplicated identity check from unicode_compare()
Move the test to PyUnicode_Compare()
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index f0aff5f..154103d 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -10428,10 +10428,6 @@ unicode_compare(PyObject *str1, PyObject *str2) 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 @@ PyUnicode_Compare(PyObject *left, PyObject *right) 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, |