Debian Codegraph @

Objects/clinic/setobject.c.h

raw
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 #include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
6
7 PyDoc_STRVAR(set_pop__doc__,
8 "pop($self, /)\n"
9 "--\n"
10 "\n"
11 "Remove and return an arbitrary set element.\n"
12 "\n"
13 "Raises KeyError if the set is empty.");
14
15 #define SET_POP_METHODDEF \
16 {"pop", (PyCFunction)set_pop, METH_NOARGS, set_pop__doc__},
17
18 static PyObject *
19 set_pop_impl(PySetObject *so);
20
21 static PyObject *
22 set_pop(PyObject *so, PyObject *Py_UNUSED(ignored))
23 {
24 PyObject *return_value = NULL;
25
26 Py_BEGIN_CRITICAL_SECTION(so);
27 return_value = set_pop_impl((PySetObject *)so);
28 Py_END_CRITICAL_SECTION();
29
30 return return_value;
31 }
32
33 PyDoc_STRVAR(set_update__doc__,
34 "update($self, /, *others)\n"
35 "--\n"
36 "\n"
37 "Update the set, adding elements from all others.");
38
39 #define SET_UPDATE_METHODDEF \
40 {"update", _PyCFunction_CAST(set_update), METH_FASTCALL, set_update__doc__},
41
42 static PyObject *
43 set_update_impl(PySetObject *so, PyObject * const *others,
44 Py_ssize_t others_length);
45
46 static PyObject *
47 set_update(PyObject *so, PyObject *const *args, Py_ssize_t nargs)
48 {
49 PyObject *return_value = NULL;
50 PyObject * const *others;
51 Py_ssize_t others_length;
52
53 others = args;
54 others_length = nargs;
55 return_value = set_update_impl((PySetObject *)so, others, others_length);
56
57 return return_value;
58 }
59
60 PyDoc_STRVAR(set_copy__doc__,
61 "copy($self, /)\n"
62 "--\n"
63 "\n"
64 "Return a shallow copy of a set.");
65
66 #define SET_COPY_METHODDEF \
67 {"copy", (PyCFunction)set_copy, METH_NOARGS, set_copy__doc__},
68
69 static PyObject *
70 set_copy_impl(PySetObject *so);
71
72 static PyObject *
73 set_copy(PyObject *so, PyObject *Py_UNUSED(ignored))
74 {
75 PyObject *return_value = NULL;
76
77 Py_BEGIN_CRITICAL_SECTION(so);
78 return_value = set_copy_impl((PySetObject *)so);
79 Py_END_CRITICAL_SECTION();
80
81 return return_value;
82 }
83
84 PyDoc_STRVAR(frozenset_copy__doc__,
85 "copy($self, /)\n"
86 "--\n"
87 "\n"
88 "Return a shallow copy of a set.");
89
90 #define FROZENSET_COPY_METHODDEF \
91 {"copy", (PyCFunction)frozenset_copy, METH_NOARGS, frozenset_copy__doc__},
92
93 static PyObject *
94 frozenset_copy_impl(PySetObject *so);
95
96 static PyObject *
97 frozenset_copy(PyObject *so, PyObject *Py_UNUSED(ignored))
98 {
99 PyObject *return_value = NULL;
100
101 Py_BEGIN_CRITICAL_SECTION(so);
102 return_value = frozenset_copy_impl((PySetObject *)so);
103 Py_END_CRITICAL_SECTION();
104
105 return return_value;
106 }
107
108 PyDoc_STRVAR(set_clear__doc__,
109 "clear($self, /)\n"
110 "--\n"
111 "\n"
112 "Remove all elements from this set.");
113
114 #define SET_CLEAR_METHODDEF \
115 {"clear", (PyCFunction)set_clear, METH_NOARGS, set_clear__doc__},
116
117 static PyObject *
118 set_clear_impl(PySetObject *so);
119
120 static PyObject *
121 set_clear(PyObject *so, PyObject *Py_UNUSED(ignored))
122 {
123 PyObject *return_value = NULL;
124
125 Py_BEGIN_CRITICAL_SECTION(so);
126 return_value = set_clear_impl((PySetObject *)so);
127 Py_END_CRITICAL_SECTION();
128
129 return return_value;
130 }
131
132 PyDoc_STRVAR(set_union__doc__,
133 "union($self, /, *others)\n"
134 "--\n"
135 "\n"
136 "Return a new set with elements from the set and all others.");
137
138 #define SET_UNION_METHODDEF \
139 {"union", _PyCFunction_CAST(set_union), METH_FASTCALL, set_union__doc__},
140
141 static PyObject *
142 set_union_impl(PySetObject *so, PyObject * const *others,
143 Py_ssize_t others_length);
144
145 static PyObject *
146 set_union(PyObject *so, PyObject *const *args, Py_ssize_t nargs)
147 {
148 PyObject *return_value = NULL;
149 PyObject * const *others;
150 Py_ssize_t others_length;
151
152 others = args;
153 others_length = nargs;
154 return_value = set_union_impl((PySetObject *)so, others, others_length);
155
156 return return_value;
157 }
158
159 PyDoc_STRVAR(set_intersection_multi__doc__,
160 "intersection($self, /, *others)\n"
161 "--\n"
162 "\n"
163 "Return a new set with elements common to the set and all others.");
164
165 #define SET_INTERSECTION_MULTI_METHODDEF \
166 {"intersection", _PyCFunction_CAST(set_intersection_multi), METH_FASTCALL, set_intersection_multi__doc__},
167
168 static PyObject *
169 set_intersection_multi_impl(PySetObject *so, PyObject * const *others,
170 Py_ssize_t others_length);
171
172 static PyObject *
173 set_intersection_multi(PyObject *so, PyObject *const *args, Py_ssize_t nargs)
174 {
175 PyObject *return_value = NULL;
176 PyObject * const *others;
177 Py_ssize_t others_length;
178
179 others = args;
180 others_length = nargs;
181 return_value = set_intersection_multi_impl((PySetObject *)so, others, others_length);
182
183 return return_value;
184 }
185
186 PyDoc_STRVAR(set_intersection_update_multi__doc__,
187 "intersection_update($self, /, *others)\n"
188 "--\n"
189 "\n"
190 "Update the set, keeping only elements found in it and all others.");
191
192 #define SET_INTERSECTION_UPDATE_MULTI_METHODDEF \
193 {"intersection_update", _PyCFunction_CAST(set_intersection_update_multi), METH_FASTCALL, set_intersection_update_multi__doc__},
194
195 static PyObject *
196 set_intersection_update_multi_impl(PySetObject *so, PyObject * const *others,
197 Py_ssize_t others_length);
198
199 static PyObject *
200 set_intersection_update_multi(PyObject *so, PyObject *const *args, Py_ssize_t nargs)
201 {
202 PyObject *return_value = NULL;
203 PyObject * const *others;
204 Py_ssize_t others_length;
205
206 others = args;
207 others_length = nargs;
208 return_value = set_intersection_update_multi_impl((PySetObject *)so, others, others_length);
209
210 return return_value;
211 }
212
213 PyDoc_STRVAR(set_isdisjoint__doc__,
214 "isdisjoint($self, other, /)\n"
215 "--\n"
216 "\n"
217 "Return True if two sets have a null intersection.");
218
219 #define SET_ISDISJOINT_METHODDEF \
220 {"isdisjoint", (PyCFunction)set_isdisjoint, METH_O, set_isdisjoint__doc__},
221
222 static PyObject *
223 set_isdisjoint_impl(PySetObject *so, PyObject *other);
224
225 static PyObject *
226 set_isdisjoint(PyObject *so, PyObject *other)
227 {
228 PyObject *return_value = NULL;
229
230 Py_BEGIN_CRITICAL_SECTION2(so, other);
231 return_value = set_isdisjoint_impl((PySetObject *)so, other);
232 Py_END_CRITICAL_SECTION2();
233
234 return return_value;
235 }
236
237 PyDoc_STRVAR(set_difference_update__doc__,
238 "difference_update($self, /, *others)\n"
239 "--\n"
240 "\n"
241 "Update the set, removing elements found in others.");
242
243 #define SET_DIFFERENCE_UPDATE_METHODDEF \
244 {"difference_update", _PyCFunction_CAST(set_difference_update), METH_FASTCALL, set_difference_update__doc__},
245
246 static PyObject *
247 set_difference_update_impl(PySetObject *so, PyObject * const *others,
248 Py_ssize_t others_length);
249
250 static PyObject *
251 set_difference_update(PyObject *so, PyObject *const *args, Py_ssize_t nargs)
252 {
253 PyObject *return_value = NULL;
254 PyObject * const *others;
255 Py_ssize_t others_length;
256
257 others = args;
258 others_length = nargs;
259 return_value = set_difference_update_impl((PySetObject *)so, others, others_length);
260
261 return return_value;
262 }
263
264 PyDoc_STRVAR(set_difference_multi__doc__,
265 "difference($self, /, *others)\n"
266 "--\n"
267 "\n"
268 "Return a new set with elements in the set that are not in the others.");
269
270 #define SET_DIFFERENCE_MULTI_METHODDEF \
271 {"difference", _PyCFunction_CAST(set_difference_multi), METH_FASTCALL, set_difference_multi__doc__},
272
273 static PyObject *
274 set_difference_multi_impl(PySetObject *so, PyObject * const *others,
275 Py_ssize_t others_length);
276
277 static PyObject *
278 set_difference_multi(PyObject *so, PyObject *const *args, Py_ssize_t nargs)
279 {
280 PyObject *return_value = NULL;
281 PyObject * const *others;
282 Py_ssize_t others_length;
283
284 others = args;
285 others_length = nargs;
286 return_value = set_difference_multi_impl((PySetObject *)so, others, others_length);
287
288 return return_value;
289 }
290
291 PyDoc_STRVAR(set_symmetric_difference_update__doc__,
292 "symmetric_difference_update($self, other, /)\n"
293 "--\n"
294 "\n"
295 "Update the set, keeping only elements found in either set, but not in both.");
296
297 #define SET_SYMMETRIC_DIFFERENCE_UPDATE_METHODDEF \
298 {"symmetric_difference_update", (PyCFunction)set_symmetric_difference_update, METH_O, set_symmetric_difference_update__doc__},
299
300 static PyObject *
301 set_symmetric_difference_update_impl(PySetObject *so, PyObject *other);
302
303 static PyObject *
304 set_symmetric_difference_update(PyObject *so, PyObject *other)
305 {
306 PyObject *return_value = NULL;
307
308 return_value = set_symmetric_difference_update_impl((PySetObject *)so, other);
309
310 return return_value;
311 }
312
313 PyDoc_STRVAR(set_symmetric_difference__doc__,
314 "symmetric_difference($self, other, /)\n"
315 "--\n"
316 "\n"
317 "Return a new set with elements in either the set or other but not both.");
318
319 #define SET_SYMMETRIC_DIFFERENCE_METHODDEF \
320 {"symmetric_difference", (PyCFunction)set_symmetric_difference, METH_O, set_symmetric_difference__doc__},
321
322 static PyObject *
323 set_symmetric_difference_impl(PySetObject *so, PyObject *other);
324
325 static PyObject *
326 set_symmetric_difference(PyObject *so, PyObject *other)
327 {
328 PyObject *return_value = NULL;
329
330 Py_BEGIN_CRITICAL_SECTION2(so, other);
331 return_value = set_symmetric_difference_impl((PySetObject *)so, other);
332 Py_END_CRITICAL_SECTION2();
333
334 return return_value;
335 }
336
337 PyDoc_STRVAR(set_issubset__doc__,
338 "issubset($self, other, /)\n"
339 "--\n"
340 "\n"
341 "Report whether another set contains this set.");
342
343 #define SET_ISSUBSET_METHODDEF \
344 {"issubset", (PyCFunction)set_issubset, METH_O, set_issubset__doc__},
345
346 static PyObject *
347 set_issubset_impl(PySetObject *so, PyObject *other);
348
349 static PyObject *
350 set_issubset(PyObject *so, PyObject *other)
351 {
352 PyObject *return_value = NULL;
353
354 Py_BEGIN_CRITICAL_SECTION2(so, other);
355 return_value = set_issubset_impl((PySetObject *)so, other);
356 Py_END_CRITICAL_SECTION2();
357
358 return return_value;
359 }
360
361 PyDoc_STRVAR(set_issuperset__doc__,
362 "issuperset($self, other, /)\n"
363 "--\n"
364 "\n"
365 "Report whether this set contains another set.");
366
367 #define SET_ISSUPERSET_METHODDEF \
368 {"issuperset", (PyCFunction)set_issuperset, METH_O, set_issuperset__doc__},
369
370 static PyObject *
371 set_issuperset_impl(PySetObject *so, PyObject *other);
372
373 static PyObject *
374 set_issuperset(PyObject *so, PyObject *other)
375 {
376 PyObject *return_value = NULL;
377
378 Py_BEGIN_CRITICAL_SECTION2(so, other);
379 return_value = set_issuperset_impl((PySetObject *)so, other);
380 Py_END_CRITICAL_SECTION2();
381
382 return return_value;
383 }
384
385 PyDoc_STRVAR(set_add__doc__,
386 "add($self, object, /)\n"
387 "--\n"
388 "\n"
389 "Add an element to a set.\n"
390 "\n"
391 "This has no effect if the element is already present.");
392
393 #define SET_ADD_METHODDEF \
394 {"add", (PyCFunction)set_add, METH_O, set_add__doc__},
395
396 static PyObject *
397 set_add_impl(PySetObject *so, PyObject *key);
398
399 static PyObject *
400 set_add(PyObject *so, PyObject *key)
401 {
402 PyObject *return_value = NULL;
403
404 Py_BEGIN_CRITICAL_SECTION(so);
405 return_value = set_add_impl((PySetObject *)so, key);
406 Py_END_CRITICAL_SECTION();
407
408 return return_value;
409 }
410
411 PyDoc_STRVAR(set___contains____doc__,
412 "__contains__($self, object, /)\n"
413 "--\n"
414 "\n"
415 "x.__contains__(y) <==> y in x.");
416
417 #define SET___CONTAINS___METHODDEF \
418 {"__contains__", (PyCFunction)set___contains__, METH_O|METH_COEXIST, set___contains____doc__},
419
420 static PyObject *
421 set___contains___impl(PySetObject *so, PyObject *key);
422
423 static PyObject *
424 set___contains__(PyObject *so, PyObject *key)
425 {
426 PyObject *return_value = NULL;
427
428 Py_BEGIN_CRITICAL_SECTION(so);
429 return_value = set___contains___impl((PySetObject *)so, key);
430 Py_END_CRITICAL_SECTION();
431
432 return return_value;
433 }
434
435 PyDoc_STRVAR(frozenset___contains____doc__,
436 "__contains__($self, object, /)\n"
437 "--\n"
438 "\n"
439 "x.__contains__(y) <==> y in x.");
440
441 #define FROZENSET___CONTAINS___METHODDEF \
442 {"__contains__", (PyCFunction)frozenset___contains__, METH_O|METH_COEXIST, frozenset___contains____doc__},
443
444 static PyObject *
445 frozenset___contains___impl(PySetObject *so, PyObject *key);
446
447 static PyObject *
448 frozenset___contains__(PyObject *so, PyObject *key)
449 {
450 PyObject *return_value = NULL;
451
452 return_value = frozenset___contains___impl((PySetObject *)so, key);
453
454 return return_value;
455 }
456
457 PyDoc_STRVAR(set_remove__doc__,
458 "remove($self, object, /)\n"
459 "--\n"
460 "\n"
461 "Remove an element from a set; it must be a member.\n"
462 "\n"
463 "If the element is not a member, raise a KeyError.");
464
465 #define SET_REMOVE_METHODDEF \
466 {"remove", (PyCFunction)set_remove, METH_O, set_remove__doc__},
467
468 static PyObject *
469 set_remove_impl(PySetObject *so, PyObject *key);
470
471 static PyObject *
472 set_remove(PyObject *so, PyObject *key)
473 {
474 PyObject *return_value = NULL;
475
476 Py_BEGIN_CRITICAL_SECTION(so);
477 return_value = set_remove_impl((PySetObject *)so, key);
478 Py_END_CRITICAL_SECTION();
479
480 return return_value;
481 }
482
483 PyDoc_STRVAR(set_discard__doc__,
484 "discard($self, object, /)\n"
485 "--\n"
486 "\n"
487 "Remove an element from a set if it is a member.\n"
488 "\n"
489 "Unlike set.remove(), the discard() method does not raise\n"
490 "an exception when an element is missing from the set.");
491
492 #define SET_DISCARD_METHODDEF \
493 {"discard", (PyCFunction)set_discard, METH_O, set_discard__doc__},
494
495 static PyObject *
496 set_discard_impl(PySetObject *so, PyObject *key);
497
498 static PyObject *
499 set_discard(PyObject *so, PyObject *key)
500 {
501 PyObject *return_value = NULL;
502
503 Py_BEGIN_CRITICAL_SECTION(so);
504 return_value = set_discard_impl((PySetObject *)so, key);
505 Py_END_CRITICAL_SECTION();
506
507 return return_value;
508 }
509
510 PyDoc_STRVAR(set___reduce____doc__,
511 "__reduce__($self, /)\n"
512 "--\n"
513 "\n"
514 "Return state information for pickling.");
515
516 #define SET___REDUCE___METHODDEF \
517 {"__reduce__", (PyCFunction)set___reduce__, METH_NOARGS, set___reduce____doc__},
518
519 static PyObject *
520 set___reduce___impl(PySetObject *so);
521
522 static PyObject *
523 set___reduce__(PyObject *so, PyObject *Py_UNUSED(ignored))
524 {
525 PyObject *return_value = NULL;
526
527 Py_BEGIN_CRITICAL_SECTION(so);
528 return_value = set___reduce___impl((PySetObject *)so);
529 Py_END_CRITICAL_SECTION();
530
531 return return_value;
532 }
533
534 PyDoc_STRVAR(set___sizeof____doc__,
535 "__sizeof__($self, /)\n"
536 "--\n"
537 "\n"
538 "S.__sizeof__() -> size of S in memory, in bytes.");
539
540 #define SET___SIZEOF___METHODDEF \
541 {"__sizeof__", (PyCFunction)set___sizeof__, METH_NOARGS, set___sizeof____doc__},
542
543 static PyObject *
544 set___sizeof___impl(PySetObject *so);
545
546 static PyObject *
547 set___sizeof__(PyObject *so, PyObject *Py_UNUSED(ignored))
548 {
549 PyObject *return_value = NULL;
550
551 Py_BEGIN_CRITICAL_SECTION(so);
552 return_value = set___sizeof___impl((PySetObject *)so);
553 Py_END_CRITICAL_SECTION();
554
555 return return_value;
556 }
557 /*[clinic end generated code: output=7f7fe845ca165078 input=a9049054013a1b77]*/