• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 #include "pycore_modsupport.h"    // _PyArg_BadArgument()
6 
7 PyDoc_STRVAR(type___instancecheck____doc__,
8 "__instancecheck__($self, instance, /)\n"
9 "--\n"
10 "\n"
11 "Check if an object is an instance.");
12 
13 #define TYPE___INSTANCECHECK___METHODDEF    \
14     {"__instancecheck__", (PyCFunction)type___instancecheck__, METH_O, type___instancecheck____doc__},
15 
16 static int
17 type___instancecheck___impl(PyTypeObject *self, PyObject *instance);
18 
19 static PyObject *
type___instancecheck__(PyTypeObject * self,PyObject * instance)20 type___instancecheck__(PyTypeObject *self, PyObject *instance)
21 {
22     PyObject *return_value = NULL;
23     int _return_value;
24 
25     _return_value = type___instancecheck___impl(self, instance);
26     if ((_return_value == -1) && PyErr_Occurred()) {
27         goto exit;
28     }
29     return_value = PyBool_FromLong((long)_return_value);
30 
31 exit:
32     return return_value;
33 }
34 
35 PyDoc_STRVAR(type___subclasscheck____doc__,
36 "__subclasscheck__($self, subclass, /)\n"
37 "--\n"
38 "\n"
39 "Check if a class is a subclass.");
40 
41 #define TYPE___SUBCLASSCHECK___METHODDEF    \
42     {"__subclasscheck__", (PyCFunction)type___subclasscheck__, METH_O, type___subclasscheck____doc__},
43 
44 static int
45 type___subclasscheck___impl(PyTypeObject *self, PyObject *subclass);
46 
47 static PyObject *
type___subclasscheck__(PyTypeObject * self,PyObject * subclass)48 type___subclasscheck__(PyTypeObject *self, PyObject *subclass)
49 {
50     PyObject *return_value = NULL;
51     int _return_value;
52 
53     _return_value = type___subclasscheck___impl(self, subclass);
54     if ((_return_value == -1) && PyErr_Occurred()) {
55         goto exit;
56     }
57     return_value = PyBool_FromLong((long)_return_value);
58 
59 exit:
60     return return_value;
61 }
62 
63 PyDoc_STRVAR(type_mro__doc__,
64 "mro($self, /)\n"
65 "--\n"
66 "\n"
67 "Return a type\'s method resolution order.");
68 
69 #define TYPE_MRO_METHODDEF    \
70     {"mro", (PyCFunction)type_mro, METH_NOARGS, type_mro__doc__},
71 
72 static PyObject *
73 type_mro_impl(PyTypeObject *self);
74 
75 static PyObject *
type_mro(PyTypeObject * self,PyObject * Py_UNUSED (ignored))76 type_mro(PyTypeObject *self, PyObject *Py_UNUSED(ignored))
77 {
78     return type_mro_impl(self);
79 }
80 
81 PyDoc_STRVAR(type___subclasses____doc__,
82 "__subclasses__($self, /)\n"
83 "--\n"
84 "\n"
85 "Return a list of immediate subclasses.");
86 
87 #define TYPE___SUBCLASSES___METHODDEF    \
88     {"__subclasses__", (PyCFunction)type___subclasses__, METH_NOARGS, type___subclasses____doc__},
89 
90 static PyObject *
91 type___subclasses___impl(PyTypeObject *self);
92 
93 static PyObject *
type___subclasses__(PyTypeObject * self,PyObject * Py_UNUSED (ignored))94 type___subclasses__(PyTypeObject *self, PyObject *Py_UNUSED(ignored))
95 {
96     return type___subclasses___impl(self);
97 }
98 
99 PyDoc_STRVAR(type___dir____doc__,
100 "__dir__($self, /)\n"
101 "--\n"
102 "\n"
103 "Specialized __dir__ implementation for types.");
104 
105 #define TYPE___DIR___METHODDEF    \
106     {"__dir__", (PyCFunction)type___dir__, METH_NOARGS, type___dir____doc__},
107 
108 static PyObject *
109 type___dir___impl(PyTypeObject *self);
110 
111 static PyObject *
type___dir__(PyTypeObject * self,PyObject * Py_UNUSED (ignored))112 type___dir__(PyTypeObject *self, PyObject *Py_UNUSED(ignored))
113 {
114     return type___dir___impl(self);
115 }
116 
117 PyDoc_STRVAR(type___sizeof____doc__,
118 "__sizeof__($self, /)\n"
119 "--\n"
120 "\n"
121 "Return memory consumption of the type object.");
122 
123 #define TYPE___SIZEOF___METHODDEF    \
124     {"__sizeof__", (PyCFunction)type___sizeof__, METH_NOARGS, type___sizeof____doc__},
125 
126 static PyObject *
127 type___sizeof___impl(PyTypeObject *self);
128 
129 static PyObject *
type___sizeof__(PyTypeObject * self,PyObject * Py_UNUSED (ignored))130 type___sizeof__(PyTypeObject *self, PyObject *Py_UNUSED(ignored))
131 {
132     return type___sizeof___impl(self);
133 }
134 
135 PyDoc_STRVAR(object___getstate____doc__,
136 "__getstate__($self, /)\n"
137 "--\n"
138 "\n"
139 "Helper for pickle.");
140 
141 #define OBJECT___GETSTATE___METHODDEF    \
142     {"__getstate__", (PyCFunction)object___getstate__, METH_NOARGS, object___getstate____doc__},
143 
144 static PyObject *
145 object___getstate___impl(PyObject *self);
146 
147 static PyObject *
object___getstate__(PyObject * self,PyObject * Py_UNUSED (ignored))148 object___getstate__(PyObject *self, PyObject *Py_UNUSED(ignored))
149 {
150     return object___getstate___impl(self);
151 }
152 
153 PyDoc_STRVAR(object___reduce____doc__,
154 "__reduce__($self, /)\n"
155 "--\n"
156 "\n"
157 "Helper for pickle.");
158 
159 #define OBJECT___REDUCE___METHODDEF    \
160     {"__reduce__", (PyCFunction)object___reduce__, METH_NOARGS, object___reduce____doc__},
161 
162 static PyObject *
163 object___reduce___impl(PyObject *self);
164 
165 static PyObject *
object___reduce__(PyObject * self,PyObject * Py_UNUSED (ignored))166 object___reduce__(PyObject *self, PyObject *Py_UNUSED(ignored))
167 {
168     return object___reduce___impl(self);
169 }
170 
171 PyDoc_STRVAR(object___reduce_ex____doc__,
172 "__reduce_ex__($self, protocol, /)\n"
173 "--\n"
174 "\n"
175 "Helper for pickle.");
176 
177 #define OBJECT___REDUCE_EX___METHODDEF    \
178     {"__reduce_ex__", (PyCFunction)object___reduce_ex__, METH_O, object___reduce_ex____doc__},
179 
180 static PyObject *
181 object___reduce_ex___impl(PyObject *self, int protocol);
182 
183 static PyObject *
object___reduce_ex__(PyObject * self,PyObject * arg)184 object___reduce_ex__(PyObject *self, PyObject *arg)
185 {
186     PyObject *return_value = NULL;
187     int protocol;
188 
189     protocol = PyLong_AsInt(arg);
190     if (protocol == -1 && PyErr_Occurred()) {
191         goto exit;
192     }
193     return_value = object___reduce_ex___impl(self, protocol);
194 
195 exit:
196     return return_value;
197 }
198 
199 PyDoc_STRVAR(object___format____doc__,
200 "__format__($self, format_spec, /)\n"
201 "--\n"
202 "\n"
203 "Default object formatter.\n"
204 "\n"
205 "Return str(self) if format_spec is empty. Raise TypeError otherwise.");
206 
207 #define OBJECT___FORMAT___METHODDEF    \
208     {"__format__", (PyCFunction)object___format__, METH_O, object___format____doc__},
209 
210 static PyObject *
211 object___format___impl(PyObject *self, PyObject *format_spec);
212 
213 static PyObject *
object___format__(PyObject * self,PyObject * arg)214 object___format__(PyObject *self, PyObject *arg)
215 {
216     PyObject *return_value = NULL;
217     PyObject *format_spec;
218 
219     if (!PyUnicode_Check(arg)) {
220         _PyArg_BadArgument("__format__", "argument", "str", arg);
221         goto exit;
222     }
223     format_spec = arg;
224     return_value = object___format___impl(self, format_spec);
225 
226 exit:
227     return return_value;
228 }
229 
230 PyDoc_STRVAR(object___sizeof____doc__,
231 "__sizeof__($self, /)\n"
232 "--\n"
233 "\n"
234 "Size of object in memory, in bytes.");
235 
236 #define OBJECT___SIZEOF___METHODDEF    \
237     {"__sizeof__", (PyCFunction)object___sizeof__, METH_NOARGS, object___sizeof____doc__},
238 
239 static PyObject *
240 object___sizeof___impl(PyObject *self);
241 
242 static PyObject *
object___sizeof__(PyObject * self,PyObject * Py_UNUSED (ignored))243 object___sizeof__(PyObject *self, PyObject *Py_UNUSED(ignored))
244 {
245     return object___sizeof___impl(self);
246 }
247 
248 PyDoc_STRVAR(object___dir____doc__,
249 "__dir__($self, /)\n"
250 "--\n"
251 "\n"
252 "Default dir() implementation.");
253 
254 #define OBJECT___DIR___METHODDEF    \
255     {"__dir__", (PyCFunction)object___dir__, METH_NOARGS, object___dir____doc__},
256 
257 static PyObject *
258 object___dir___impl(PyObject *self);
259 
260 static PyObject *
object___dir__(PyObject * self,PyObject * Py_UNUSED (ignored))261 object___dir__(PyObject *self, PyObject *Py_UNUSED(ignored))
262 {
263     return object___dir___impl(self);
264 }
265 /*[clinic end generated code: output=b56c87f9cace1921 input=a9049054013a1b77]*/
266