Coverage Report

Created: 2026-12-01 06:09

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.64k
{
66
1.64k
    PyObject *return_value = NULL;
67
1.64k
    PyObject *self;
68
1.64k
    PyObject *subclass;
69
70
1.64k
    if (!_PyArg_CheckPositional("_abc_register", nargs, 2, 2)) {
71
0
        goto exit;
72
0
    }
73
1.64k
    self = args[0];
74
1.64k
    subclass = args[1];
75
1.64k
    return_value = _abc__abc_register_impl(module, self, subclass);
76
77
1.64k
exit:
78
1.64k
    return return_value;
79
1.64k
}
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
85.6k
{
97
85.6k
    PyObject *return_value = NULL;
98
85.6k
    PyObject *self;
99
85.6k
    PyObject *instance;
100
101
85.6k
    if (!_PyArg_CheckPositional("_abc_instancecheck", nargs, 2, 2)) {
102
0
        goto exit;
103
0
    }
104
85.6k
    self = args[0];
105
85.6k
    instance = args[1];
106
85.6k
    return_value = _abc__abc_instancecheck_impl(module, self, instance);
107
108
85.6k
exit:
109
85.6k
    return return_value;
110
85.6k
}
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
1.67k
{
128
1.67k
    PyObject *return_value = NULL;
129
1.67k
    PyObject *self;
130
1.67k
    PyObject *subclass;
131
132
1.67k
    if (!_PyArg_CheckPositional("_abc_subclasscheck", nargs, 2, 2)) {
133
0
        goto exit;
134
0
    }
135
1.67k
    self = args[0];
136
1.67k
    subclass = args[1];
137
1.67k
    return_value = _abc__abc_subclasscheck_impl(module, self, subclass);
138
139
1.67k
exit:
140
1.67k
    return return_value;
141
1.67k
}
142
143
PyDoc_STRVAR(_abc__set_subclasscheck__doc__,
144
"_set_subclasscheck($module, func, /)\n"
145
"--\n"
146
"\n"
147
"Internal ABC helper to register ABCMeta.__subclasscheck__.\n"
148
"\n"
149
"Classes whose metaclass resolves __subclasscheck__ to func are checked\n"
150
"natively when walking the subclass tree of an ABC.");
151
152
#define _ABC__SET_SUBCLASSCHECK_METHODDEF    \
153
    {"_set_subclasscheck", (PyCFunction)_abc__set_subclasscheck, METH_O, _abc__set_subclasscheck__doc__},
154
155
PyDoc_STRVAR(_abc_get_cache_token__doc__,
156
"get_cache_token($module, /)\n"
157
"--\n"
158
"\n"
159
"Returns the current ABC cache token.\n"
160
"\n"
161
"The token is an opaque object (supporting equality testing) identifying\n"
162
"the current version of the ABC cache for virtual subclasses.  The token\n"
163
"changes with every call to register() on any ABC.");
164
165
#define _ABC_GET_CACHE_TOKEN_METHODDEF    \
166
    {"get_cache_token", (PyCFunction)_abc_get_cache_token, METH_NOARGS, _abc_get_cache_token__doc__},
167
168
static PyObject *
169
_abc_get_cache_token_impl(PyObject *module);
170
171
static PyObject *
172
_abc_get_cache_token(PyObject *module, PyObject *Py_UNUSED(ignored))
173
0
{
174
0
    return _abc_get_cache_token_impl(module);
175
0
}
176
/*[clinic end generated code: output=5d71c05c399149c5 input=a9049054013a1b77]*/