MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / __Pyx_PyUnicode_Equals

Function __Pyx_PyUnicode_Equals

eval/CIPO_evaluation/pycocotools/_mask.c:10812–10911  ·  view source on GitHub ↗

UnicodeEquals */

Source from the content-addressed store, hash-verified

10810
10811/* UnicodeEquals */
10812static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
10813#if CYTHON_COMPILING_IN_PYPY
10814 return PyObject_RichCompareBool(s1, s2, equals);
10815#else
10816#if PY_MAJOR_VERSION < 3
10817 PyObject* owned_ref = NULL;
10818#endif
10819 int s1_is_unicode, s2_is_unicode;
10820 if (s1 == s2) {
10821 goto return_eq;
10822 }
10823 s1_is_unicode = PyUnicode_CheckExact(s1);
10824 s2_is_unicode = PyUnicode_CheckExact(s2);
10825#if PY_MAJOR_VERSION < 3
10826 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
10827 owned_ref = PyUnicode_FromObject(s2);
10828 if (unlikely(!owned_ref))
10829 return -1;
10830 s2 = owned_ref;
10831 s2_is_unicode = 1;
10832 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
10833 owned_ref = PyUnicode_FromObject(s1);
10834 if (unlikely(!owned_ref))
10835 return -1;
10836 s1 = owned_ref;
10837 s1_is_unicode = 1;
10838 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
10839 return __Pyx_PyBytes_Equals(s1, s2, equals);
10840 }
10841#endif
10842 if (s1_is_unicode & s2_is_unicode) {
10843 Py_ssize_t length;
10844 int kind;
10845 void *data1, *data2;
10846 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
10847 return -1;
10848 length = __Pyx_PyUnicode_GET_LENGTH(s1);
10849 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
10850 goto return_ne;
10851 }
10852#if CYTHON_USE_UNICODE_INTERNALS
10853 {
10854 Py_hash_t hash1, hash2;
10855 #if CYTHON_PEP393_ENABLED
10856 hash1 = ((PyASCIIObject*)s1)->hash;
10857 hash2 = ((PyASCIIObject*)s2)->hash;
10858 #else
10859 hash1 = ((PyUnicodeObject*)s1)->hash;
10860 hash2 = ((PyUnicodeObject*)s2)->hash;
10861 #endif
10862 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10863 goto return_ne;
10864 }
10865 }
10866#endif
10867 kind = __Pyx_PyUnicode_KIND(s1);
10868 if (kind != __Pyx_PyUnicode_KIND(s2)) {
10869 goto return_ne;

Callers

nothing calls this directly

Calls 2

__Pyx_PyBytes_EqualsFunction · 0.85
__Pyx_PyObject_IsTrueFunction · 0.85

Tested by

no test coverage detected