diff options
author | Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com> | 2021-12-03 11:29:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 11:29:12 (GMT) |
commit | 03768c4d139df46212a091ed931aad03bec18b57 (patch) | |
tree | 35ab5e03aacded970ee0b1d21077f18782176c08 /Objects | |
parent | 99fcf1505218464c489d419d4500f126b6d6dc28 (diff) | |
download | cpython-03768c4d139df46212a091ed931aad03bec18b57.zip cpython-03768c4d139df46212a091ed931aad03bec18b57.tar.gz cpython-03768c4d139df46212a091ed931aad03bec18b57.tar.bz2 |
bpo-45885: Specialize COMPARE_OP (GH-29734)
* Add COMPARE_OP_ADAPTIVE adaptive instruction.
* Add COMPARE_OP_FLOAT_JUMP, COMPARE_OP_INT_JUMP and COMPARE_OP_STR_JUMP specialized instructions.
* Introduce and use _PyUnicode_Equal
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 61fc34d..532c48a 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -11168,6 +11168,20 @@ unicode_compare_eq(PyObject *str1, PyObject *str2) return (cmp == 0); } +int +_PyUnicode_Equal(PyObject *str1, PyObject *str2) +{ + assert(PyUnicode_CheckExact(str1)); + assert(PyUnicode_CheckExact(str2)); + if (str1 == str2) { + return 1; + } + if (PyUnicode_READY(str1) || PyUnicode_READY(str2)) { + return -1; + } + return unicode_compare_eq(str1, str2); +} + int PyUnicode_Compare(PyObject *left, PyObject *right) |