Coverage Report

Created: 2026-03-08 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython/Modules/clinic/_abc.c.h
Line
Count
Source
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
#include "pycore_modsupport.h"    // _PyArg_CheckPositional()
6
7
PyDoc_STRVAR(_abc__reset_registry__doc__,
8
"_reset_registry($module, self, /)\n"
9
"--\n"
10
"\n"
11
"Internal ABC helper to reset registry of a given class.\n"
12
"\n"
13
"Should be only used by refleak.py");
14
15
#define _ABC__RESET_REGISTRY_METHODDEF    \
16
    {"_reset_registry", (PyCFunction)_abc__reset_registry, METH_O, _abc__reset_registry__doc__},
17
18
PyDoc_STRVAR(_abc__reset_caches__doc__,
19
"_reset_caches($module, self, /)\n"
20
"--\n"
21
"\n"
22
"Internal ABC helper to reset both caches of a given class.\n"
23
"\n"
24
"Should be only used by refleak.py");
25
26
#define _ABC__RESET_CACHES_METHODDEF    \
27
    {"_reset_caches", (PyCFunction)_abc__reset_caches, METH_O, _abc__reset_caches__doc__},
28
29
PyDoc_STRVAR(_abc__get_dump__doc__,
30
"_get_dump($module, self, /)\n"
31
"--\n"
32
"\n"
33
"Internal ABC helper for cache and registry debugging.\n"
34
"\n"
35
"Return shallow copies of registry, of both caches, and\n"
36
"negative cache version. Don\'t call this function directly,\n"
37
"instead use ABC._dump_registry() for a nice repr.");
38
39
#define _ABC__GET_DUMP_METHODDEF    \
40
    {"_get_dump", (PyCFunction)_abc__get_dump, METH_O, _abc__get_dump__doc__},
41
42
PyDoc_STRVAR(_abc__abc_init__doc__,
43
"_abc_init($module, self, /)\n"
44
"--\n"
45
"\n"
46
"Internal ABC helper for class set-up. Should be never used outside abc module.");
47
48
#define _ABC__ABC_INIT_METHODDEF    \
49
    {"_abc_init", (PyCFunction)_abc__abc_init, METH_O, _abc__abc_init__doc__},
50
51
PyDoc_STRVAR(_abc__abc_register__doc__,
52
"_abc_register($module, self, subclass, /)\n"
53
"--\n"
54
"\n"
55
"Internal ABC helper for subclasss registration. Should be never used outside abc module.");
56
57
#define _ABC__ABC_REGISTER_METHODDEF    \
58
    {"_abc_register", _PyCFunction_CAST(_abc__abc_register), METH_FASTCALL, _abc__abc_register__doc__},
59
60
static PyObject *
61
_abc__abc_register_impl(PyObject *module, PyObject *self, PyObject *subclass);
62
63
static PyObject *
64
_abc__abc_register(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
65
1.55k
{
66
1.55k
    PyObject *return_value = NULL;
67
1.55k
    PyObject *self;
68
1.55k
    PyObject *subclass;
69
70
1.55k
    if (!_PyArg_CheckPositional("_abc_register", nargs, 2, 2)) {
71
0
        goto exit;
72
0
    }
73
1.55k
    self = args[0];
74
1.55k
    subclass = args[1];
75
1.55k
    return_value = _abc__abc_register_impl(module, self, subclass);
76
77
1.55k
exit:
78
1.55k
    return return_value;
79
1.55k
}
80
81
PyDoc_STRVAR(_abc__abc_instancecheck__doc__,
82
"_abc_instancecheck($module, self, instance, /)\n"
83
"--\n"
84
"\n"
85
"Internal ABC helper for instance checks. Should be never used outside abc module.");
86
87
#define _ABC__ABC_INSTANCECHECK_METHODDEF    \
88
    {"_abc_instancecheck", _PyCFunction_CAST(_abc__abc_instancecheck), METH_FASTCALL, _abc__abc_instancecheck__doc__},
89
90
static PyObject *
91
_abc__abc_instancecheck_impl(PyObject *module, PyObject *self,
92
                             PyObject *instance);
93
94
static PyObject *
95
_abc__abc_instancecheck(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
96
101k
{
97
101k
    PyObject *return_value = NULL;
98
101k
    PyObject *self;
99
101k
    PyObject *instance;
100
101
101k
    if (!_PyArg_CheckPositional("_abc_instancecheck", nargs, 2, 2)) {
102
0
        goto exit;
103
0
    }
104
101k
    self = args[0];
105
101k
    instance = args[1];
106
101k
    return_value = _abc__abc_instancecheck_impl(module, self, instance);
107
108
101k
exit:
109
101k
    return return_value;
110
101k
}
111
112
PyDoc_STRVAR(_abc__abc_subclasscheck__doc__,
113
"_abc_subclasscheck($module, self, subclass, /)\n"
114
"--\n"
115
"\n"
116
"Internal ABC helper for subclasss checks. Should be never used outside abc module.");
117
118
#define _ABC__ABC_SUBCLASSCHECK_METHODDEF    \
119
    {"_abc_subclasscheck", _PyCFunction_CAST(_abc__abc_subclasscheck), METH_FASTCALL, _abc__abc_subclasscheck__doc__},
120
121
static PyObject *
122
_abc__abc_subclasscheck_impl(PyObject *module, PyObject *self,
123
                             PyObject *subclass);
124
125
static PyObject *
126
_abc__abc_subclasscheck(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
127
39.4k
{
128
39.4k
    PyObject *return_value = NULL;
129
39.4k
    PyObject *self;
130
39.4k
    PyObject *subclass;
131
132
39.4k
    if (!_PyArg_CheckPositional("_abc_subclasscheck", nargs, 2, 2)) {
133
0
        goto exit;
134
0
    }
135
39.4k
    self = args[0];
136
39.4k
    subclass = args[1];
137
39.4k
    return_value = _abc__abc_subclasscheck_impl(module, self, subclass);
138
139
39.4k
exit:
140
39.4k
    return return_value;
141
39.4k
}
142
143
PyDoc_STRVAR(_abc_get_cache_token__doc__,
144
"get_cache_token($module, /)\n"
145
"--\n"
146
"\n"
147
"Returns the current ABC cache token.\n"
148
"\n"
149
"The token is an opaque object (supporting equality testing) identifying the\n"
150
"current version of the ABC cache for virtual subclasses. The token changes\n"
151
"with every call to register() on any ABC.");
152
153
#define _ABC_GET_CACHE_TOKEN_METHODDEF    \
154
    {"get_cache_token", (PyCFunction)_abc_get_cache_token, METH_NOARGS, _abc_get_cache_token__doc__},
155
156
static PyObject *
157
_abc_get_cache_token_impl(PyObject *module);
158
159
static PyObject *
160
_abc_get_cache_token(PyObject *module, PyObject *Py_UNUSED(ignored))
161
0
{
162
0
    return _abc_get_cache_token_impl(module);
163
0
}
164
/*[clinic end generated code: output=1989b6716c950e17 input=a9049054013a1b77]*/