Coverage Report

Created: 2026-06-14 06:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/Python-3.8.3/Objects/stringlib/eq.h
Line
Count
Source
1
/* Fast unicode equal function optimized for dictobject.c and setobject.c */
2
3
/* Return 1 if two unicode objects are equal, 0 if not.
4
 * unicode_eq() is called when the hash of two unicode objects is equal.
5
 */
6
Py_LOCAL_INLINE(int)
7
unicode_eq(PyObject *aa, PyObject *bb)
8
52.0k
{
9
52.0k
    PyUnicodeObject *a = (PyUnicodeObject *)aa;
10
52.0k
    PyUnicodeObject *b = (PyUnicodeObject *)bb;
11
12
52.0k
    if (PyUnicode_READY(a) == -1 || PyUnicode_READY(b) == -1) {
13
0
        Py_UNREACHABLE();
14
0
    }
15
16
52.0k
    if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b))
17
119
        return 0;
18
51.9k
    if (PyUnicode_GET_LENGTH(a) == 0)
19
0
        return 1;
20
51.9k
    if (PyUnicode_KIND(a) != PyUnicode_KIND(b))
21
0
        return 0;
22
51.9k
    return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b),
23
51.9k
                  PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0;
24
51.9k
}
dictobject.c:unicode_eq
Line
Count
Source
8
51.6k
{
9
51.6k
    PyUnicodeObject *a = (PyUnicodeObject *)aa;
10
51.6k
    PyUnicodeObject *b = (PyUnicodeObject *)bb;
11
12
51.6k
    if (PyUnicode_READY(a) == -1 || PyUnicode_READY(b) == -1) {
13
0
        Py_UNREACHABLE();
14
0
    }
15
16
51.6k
    if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b))
17
0
        return 0;
18
51.6k
    if (PyUnicode_GET_LENGTH(a) == 0)
19
0
        return 1;
20
51.6k
    if (PyUnicode_KIND(a) != PyUnicode_KIND(b))
21
0
        return 0;
22
51.6k
    return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b),
23
51.6k
                  PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0;
24
51.6k
}
unicodeobject.c:unicode_eq
Line
Count
Source
8
408
{
9
408
    PyUnicodeObject *a = (PyUnicodeObject *)aa;
10
408
    PyUnicodeObject *b = (PyUnicodeObject *)bb;
11
12
408
    if (PyUnicode_READY(a) == -1 || PyUnicode_READY(b) == -1) {
13
0
        Py_UNREACHABLE();
14
0
    }
15
16
408
    if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b))
17
119
        return 0;
18
289
    if (PyUnicode_GET_LENGTH(a) == 0)
19
0
        return 1;
20
289
    if (PyUnicode_KIND(a) != PyUnicode_KIND(b))
21
0
        return 0;
22
289
    return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b),
23
289
                  PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0;
24
289
}