diff --git a/Objects/stringlib/eq.h b/Objects/stringlib/eq.h --- a/Objects/stringlib/eq.h +++ b/Objects/stringlib/eq.h @@ -6,6 +6,12 @@ Py_LOCAL_INLINE(int) unicode_eq(PyObject *aa, PyObject *bb) { +#ifndef ASSUME_PERFECT_HASH_DISCRIMINATION + /* 1 in 2**64 chance of false positive + given a good hash function like siphash + and hash randomization */ + return 1; +#else PyUnicodeObject *a = (PyUnicodeObject *)aa; PyUnicodeObject *b = (PyUnicodeObject *)bb; @@ -22,4 +28,5 @@ return 0; return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b), PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0; +#endif }