Coverage Report

Created: 2026-09-14 06:37

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.4k
{
9
52.4k
    PyUnicodeObject *a = (PyUnicodeObject *)aa;
10
52.4k
    PyUnicodeObject *b = (PyUnicodeObject *)bb;
11
12
52.4k
    if (PyUnicode_READY(a) == -1 || PyUnicode_READY(b) == -1) {
13
0
        Py_UNREACHABLE();
14
0
    }
15
16
52.4k
    if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b))
17
119
        return 0;
18
52.3k
    if (PyUnicode_GET_LENGTH(a) == 0)
19
0
        return 1;
20
52.3k
    if (PyUnicode_KIND(a) != PyUnicode_KIND(b))
21
0
        return 0;
22
52.3k
    return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b),
23
52.3k
                  PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0;
24
52.3k
}
dictobject.c:unicode_eq
Line
Count
Source
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
0
        return 0;
18
52.0k
    if (PyUnicode_GET_LENGTH(a) == 0)
19
0
        return 1;
20
52.0k
    if (PyUnicode_KIND(a) != PyUnicode_KIND(b))
21
0
        return 0;
22
52.0k
    return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b),
23
52.0k
                  PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0;
24
52.0k
}
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
}