Coverage Report

Created: 2026-12-01 06:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython/Modules/clinic/_operator.c.h
Line
Count
Source
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
#include "pycore_abstract.h"      // _PyNumber_Index()
6
#include "pycore_modsupport.h"    // _PyArg_CheckPositional()
7
#include "pycore_tuple.h"         // _PyTuple_ITEMS()
8
9
PyDoc_STRVAR(_operator_truth__doc__,
10
"truth($module, a, /)\n"
11
"--\n"
12
"\n"
13
"Return True if a is true, False otherwise.");
14
15
#define _OPERATOR_TRUTH_METHODDEF    \
16
    {"truth", (PyCFunction)_operator_truth, METH_O, _operator_truth__doc__},
17
18
static int
19
_operator_truth_impl(PyObject *module, PyObject *a);
20
21
static PyObject *
22
_operator_truth(PyObject *module, PyObject *a)
23
0
{
24
0
    PyObject *return_value = NULL;
25
0
    int _return_value;
26
27
0
    _return_value = _operator_truth_impl(module, a);
28
0
    if ((_return_value == -1) && PyErr_Occurred()) {
29
0
        goto exit;
30
0
    }
31
0
    return_value = PyBool_FromLong((long)_return_value);
32
33
0
exit:
34
0
    return return_value;
35
0
}
36
37
PyDoc_STRVAR(_operator_add__doc__,
38
"add($module, a, b, /)\n"
39
"--\n"
40
"\n"
41
"Same as a + b.");
42
43
#define _OPERATOR_ADD_METHODDEF    \
44
    {"add", _PyCFunction_CAST(_operator_add), METH_FASTCALL, _operator_add__doc__},
45
46
static PyObject *
47
_operator_add_impl(PyObject *module, PyObject *a, PyObject *b);
48
49
static PyObject *
50
_operator_add(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
51
0
{
52
0
    PyObject *return_value = NULL;
53
0
    PyObject *a;
54
0
    PyObject *b;
55
56
0
    if (!_PyArg_CheckPositional("add", nargs, 2, 2)) {
57
0
        goto exit;
58
0
    }
59
0
    a = args[0];
60
0
    b = args[1];
61
0
    return_value = _operator_add_impl(module, a, b);
62
63
0
exit:
64
0
    return return_value;
65
0
}
66
67
PyDoc_STRVAR(_operator_sub__doc__,
68
"sub($module, a, b, /)\n"
69
"--\n"
70
"\n"
71
"Same as a - b.");
72
73
#define _OPERATOR_SUB_METHODDEF    \
74
    {"sub", _PyCFunction_CAST(_operator_sub), METH_FASTCALL, _operator_sub__doc__},
75
76
static PyObject *
77
_operator_sub_impl(PyObject *module, PyObject *a, PyObject *b);
78
79
static PyObject *
80
_operator_sub(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
81
0
{
82
0
    PyObject *return_value = NULL;
83
0
    PyObject *a;
84
0
    PyObject *b;
85
86
0
    if (!_PyArg_CheckPositional("sub", nargs, 2, 2)) {
87
0
        goto exit;
88
0
    }
89
0
    a = args[0];
90
0
    b = args[1];
91
0
    return_value = _operator_sub_impl(module, a, b);
92
93
0
exit:
94
0
    return return_value;
95
0
}
96
97
PyDoc_STRVAR(_operator_mul__doc__,
98
"mul($module, a, b, /)\n"
99
"--\n"
100
"\n"
101
"Same as a * b.");
102
103
#define _OPERATOR_MUL_METHODDEF    \
104
    {"mul", _PyCFunction_CAST(_operator_mul), METH_FASTCALL, _operator_mul__doc__},
105
106
static PyObject *
107
_operator_mul_impl(PyObject *module, PyObject *a, PyObject *b);
108
109
static PyObject *
110
_operator_mul(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
111
0
{
112
0
    PyObject *return_value = NULL;
113
0
    PyObject *a;
114
0
    PyObject *b;
115
116
0
    if (!_PyArg_CheckPositional("mul", nargs, 2, 2)) {
117
0
        goto exit;
118
0
    }
119
0
    a = args[0];
120
0
    b = args[1];
121
0
    return_value = _operator_mul_impl(module, a, b);
122
123
0
exit:
124
0
    return return_value;
125
0
}
126
127
PyDoc_STRVAR(_operator_matmul__doc__,
128
"matmul($module, a, b, /)\n"
129
"--\n"
130
"\n"
131
"Same as a @ b.");
132
133
#define _OPERATOR_MATMUL_METHODDEF    \
134
    {"matmul", _PyCFunction_CAST(_operator_matmul), METH_FASTCALL, _operator_matmul__doc__},
135
136
static PyObject *
137
_operator_matmul_impl(PyObject *module, PyObject *a, PyObject *b);
138
139
static PyObject *
140
_operator_matmul(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
141
0
{
142
0
    PyObject *return_value = NULL;
143
0
    PyObject *a;
144
0
    PyObject *b;
145
146
0
    if (!_PyArg_CheckPositional("matmul", nargs, 2, 2)) {
147
0
        goto exit;
148
0
    }
149
0
    a = args[0];
150
0
    b = args[1];
151
0
    return_value = _operator_matmul_impl(module, a, b);
152
153
0
exit:
154
0
    return return_value;
155
0
}
156
157
PyDoc_STRVAR(_operator_floordiv__doc__,
158
"floordiv($module, a, b, /)\n"
159
"--\n"
160
"\n"
161
"Same as a // b.");
162
163
#define _OPERATOR_FLOORDIV_METHODDEF    \
164
    {"floordiv", _PyCFunction_CAST(_operator_floordiv), METH_FASTCALL, _operator_floordiv__doc__},
165
166
static PyObject *
167
_operator_floordiv_impl(PyObject *module, PyObject *a, PyObject *b);
168
169
static PyObject *
170
_operator_floordiv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
171
0
{
172
0
    PyObject *return_value = NULL;
173
0
    PyObject *a;
174
0
    PyObject *b;
175
176
0
    if (!_PyArg_CheckPositional("floordiv", nargs, 2, 2)) {
177
0
        goto exit;
178
0
    }
179
0
    a = args[0];
180
0
    b = args[1];
181
0
    return_value = _operator_floordiv_impl(module, a, b);
182
183
0
exit:
184
0
    return return_value;
185
0
}
186
187
PyDoc_STRVAR(_operator_truediv__doc__,
188
"truediv($module, a, b, /)\n"
189
"--\n"
190
"\n"
191
"Same as a / b.");
192
193
#define _OPERATOR_TRUEDIV_METHODDEF    \
194
    {"truediv", _PyCFunction_CAST(_operator_truediv), METH_FASTCALL, _operator_truediv__doc__},
195
196
static PyObject *
197
_operator_truediv_impl(PyObject *module, PyObject *a, PyObject *b);
198
199
static PyObject *
200
_operator_truediv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
201
0
{
202
0
    PyObject *return_value = NULL;
203
0
    PyObject *a;
204
0
    PyObject *b;
205
206
0
    if (!_PyArg_CheckPositional("truediv", nargs, 2, 2)) {
207
0
        goto exit;
208
0
    }
209
0
    a = args[0];
210
0
    b = args[1];
211
0
    return_value = _operator_truediv_impl(module, a, b);
212
213
0
exit:
214
0
    return return_value;
215
0
}
216
217
PyDoc_STRVAR(_operator_mod__doc__,
218
"mod($module, a, b, /)\n"
219
"--\n"
220
"\n"
221
"Same as a % b.");
222
223
#define _OPERATOR_MOD_METHODDEF    \
224
    {"mod", _PyCFunction_CAST(_operator_mod), METH_FASTCALL, _operator_mod__doc__},
225
226
static PyObject *
227
_operator_mod_impl(PyObject *module, PyObject *a, PyObject *b);
228
229
static PyObject *
230
_operator_mod(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
231
0
{
232
0
    PyObject *return_value = NULL;
233
0
    PyObject *a;
234
0
    PyObject *b;
235
236
0
    if (!_PyArg_CheckPositional("mod", nargs, 2, 2)) {
237
0
        goto exit;
238
0
    }
239
0
    a = args[0];
240
0
    b = args[1];
241
0
    return_value = _operator_mod_impl(module, a, b);
242
243
0
exit:
244
0
    return return_value;
245
0
}
246
247
PyDoc_STRVAR(_operator_neg__doc__,
248
"neg($module, a, /)\n"
249
"--\n"
250
"\n"
251
"Same as -a.");
252
253
#define _OPERATOR_NEG_METHODDEF    \
254
    {"neg", (PyCFunction)_operator_neg, METH_O, _operator_neg__doc__},
255
256
PyDoc_STRVAR(_operator_pos__doc__,
257
"pos($module, a, /)\n"
258
"--\n"
259
"\n"
260
"Same as +a.");
261
262
#define _OPERATOR_POS_METHODDEF    \
263
    {"pos", (PyCFunction)_operator_pos, METH_O, _operator_pos__doc__},
264
265
PyDoc_STRVAR(_operator_abs__doc__,
266
"abs($module, a, /)\n"
267
"--\n"
268
"\n"
269
"Same as abs(a).");
270
271
#define _OPERATOR_ABS_METHODDEF    \
272
    {"abs", (PyCFunction)_operator_abs, METH_O, _operator_abs__doc__},
273
274
PyDoc_STRVAR(_operator_inv__doc__,
275
"inv($module, a, /)\n"
276
"--\n"
277
"\n"
278
"Same as ~a.");
279
280
#define _OPERATOR_INV_METHODDEF    \
281
    {"inv", (PyCFunction)_operator_inv, METH_O, _operator_inv__doc__},
282
283
PyDoc_STRVAR(_operator_invert__doc__,
284
"invert($module, a, /)\n"
285
"--\n"
286
"\n"
287
"Same as ~a.");
288
289
#define _OPERATOR_INVERT_METHODDEF    \
290
    {"invert", (PyCFunction)_operator_invert, METH_O, _operator_invert__doc__},
291
292
PyDoc_STRVAR(_operator_lshift__doc__,
293
"lshift($module, a, b, /)\n"
294
"--\n"
295
"\n"
296
"Same as a << b.");
297
298
#define _OPERATOR_LSHIFT_METHODDEF    \
299
    {"lshift", _PyCFunction_CAST(_operator_lshift), METH_FASTCALL, _operator_lshift__doc__},
300
301
static PyObject *
302
_operator_lshift_impl(PyObject *module, PyObject *a, PyObject *b);
303
304
static PyObject *
305
_operator_lshift(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
306
0
{
307
0
    PyObject *return_value = NULL;
308
0
    PyObject *a;
309
0
    PyObject *b;
310
311
0
    if (!_PyArg_CheckPositional("lshift", nargs, 2, 2)) {
312
0
        goto exit;
313
0
    }
314
0
    a = args[0];
315
0
    b = args[1];
316
0
    return_value = _operator_lshift_impl(module, a, b);
317
318
0
exit:
319
0
    return return_value;
320
0
}
321
322
PyDoc_STRVAR(_operator_rshift__doc__,
323
"rshift($module, a, b, /)\n"
324
"--\n"
325
"\n"
326
"Same as a >> b.");
327
328
#define _OPERATOR_RSHIFT_METHODDEF    \
329
    {"rshift", _PyCFunction_CAST(_operator_rshift), METH_FASTCALL, _operator_rshift__doc__},
330
331
static PyObject *
332
_operator_rshift_impl(PyObject *module, PyObject *a, PyObject *b);
333
334
static PyObject *
335
_operator_rshift(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
336
0
{
337
0
    PyObject *return_value = NULL;
338
0
    PyObject *a;
339
0
    PyObject *b;
340
341
0
    if (!_PyArg_CheckPositional("rshift", nargs, 2, 2)) {
342
0
        goto exit;
343
0
    }
344
0
    a = args[0];
345
0
    b = args[1];
346
0
    return_value = _operator_rshift_impl(module, a, b);
347
348
0
exit:
349
0
    return return_value;
350
0
}
351
352
PyDoc_STRVAR(_operator_not___doc__,
353
"not_($module, a, /)\n"
354
"--\n"
355
"\n"
356
"Same as not a.");
357
358
#define _OPERATOR_NOT__METHODDEF    \
359
    {"not_", (PyCFunction)_operator_not_, METH_O, _operator_not___doc__},
360
361
static int
362
_operator_not__impl(PyObject *module, PyObject *a);
363
364
static PyObject *
365
_operator_not_(PyObject *module, PyObject *a)
366
0
{
367
0
    PyObject *return_value = NULL;
368
0
    int _return_value;
369
370
0
    _return_value = _operator_not__impl(module, a);
371
0
    if ((_return_value == -1) && PyErr_Occurred()) {
372
0
        goto exit;
373
0
    }
374
0
    return_value = PyBool_FromLong((long)_return_value);
375
376
0
exit:
377
0
    return return_value;
378
0
}
379
380
PyDoc_STRVAR(_operator_and___doc__,
381
"and_($module, a, b, /)\n"
382
"--\n"
383
"\n"
384
"Same as a & b.");
385
386
#define _OPERATOR_AND__METHODDEF    \
387
    {"and_", _PyCFunction_CAST(_operator_and_), METH_FASTCALL, _operator_and___doc__},
388
389
static PyObject *
390
_operator_and__impl(PyObject *module, PyObject *a, PyObject *b);
391
392
static PyObject *
393
_operator_and_(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
394
0
{
395
0
    PyObject *return_value = NULL;
396
0
    PyObject *a;
397
0
    PyObject *b;
398
399
0
    if (!_PyArg_CheckPositional("and_", nargs, 2, 2)) {
400
0
        goto exit;
401
0
    }
402
0
    a = args[0];
403
0
    b = args[1];
404
0
    return_value = _operator_and__impl(module, a, b);
405
406
0
exit:
407
0
    return return_value;
408
0
}
409
410
PyDoc_STRVAR(_operator_xor__doc__,
411
"xor($module, a, b, /)\n"
412
"--\n"
413
"\n"
414
"Same as a ^ b.");
415
416
#define _OPERATOR_XOR_METHODDEF    \
417
    {"xor", _PyCFunction_CAST(_operator_xor), METH_FASTCALL, _operator_xor__doc__},
418
419
static PyObject *
420
_operator_xor_impl(PyObject *module, PyObject *a, PyObject *b);
421
422
static PyObject *
423
_operator_xor(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
424
0
{
425
0
    PyObject *return_value = NULL;
426
0
    PyObject *a;
427
0
    PyObject *b;
428
429
0
    if (!_PyArg_CheckPositional("xor", nargs, 2, 2)) {
430
0
        goto exit;
431
0
    }
432
0
    a = args[0];
433
0
    b = args[1];
434
0
    return_value = _operator_xor_impl(module, a, b);
435
436
0
exit:
437
0
    return return_value;
438
0
}
439
440
PyDoc_STRVAR(_operator_or___doc__,
441
"or_($module, a, b, /)\n"
442
"--\n"
443
"\n"
444
"Same as a | b.");
445
446
#define _OPERATOR_OR__METHODDEF    \
447
    {"or_", _PyCFunction_CAST(_operator_or_), METH_FASTCALL, _operator_or___doc__},
448
449
static PyObject *
450
_operator_or__impl(PyObject *module, PyObject *a, PyObject *b);
451
452
static PyObject *
453
_operator_or_(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
454
0
{
455
0
    PyObject *return_value = NULL;
456
0
    PyObject *a;
457
0
    PyObject *b;
458
459
0
    if (!_PyArg_CheckPositional("or_", nargs, 2, 2)) {
460
0
        goto exit;
461
0
    }
462
0
    a = args[0];
463
0
    b = args[1];
464
0
    return_value = _operator_or__impl(module, a, b);
465
466
0
exit:
467
0
    return return_value;
468
0
}
469
470
PyDoc_STRVAR(_operator_iadd__doc__,
471
"iadd($module, a, b, /)\n"
472
"--\n"
473
"\n"
474
"Same as a += b.");
475
476
#define _OPERATOR_IADD_METHODDEF    \
477
    {"iadd", _PyCFunction_CAST(_operator_iadd), METH_FASTCALL, _operator_iadd__doc__},
478
479
static PyObject *
480
_operator_iadd_impl(PyObject *module, PyObject *a, PyObject *b);
481
482
static PyObject *
483
_operator_iadd(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
484
0
{
485
0
    PyObject *return_value = NULL;
486
0
    PyObject *a;
487
0
    PyObject *b;
488
489
0
    if (!_PyArg_CheckPositional("iadd", nargs, 2, 2)) {
490
0
        goto exit;
491
0
    }
492
0
    a = args[0];
493
0
    b = args[1];
494
0
    return_value = _operator_iadd_impl(module, a, b);
495
496
0
exit:
497
0
    return return_value;
498
0
}
499
500
PyDoc_STRVAR(_operator_isub__doc__,
501
"isub($module, a, b, /)\n"
502
"--\n"
503
"\n"
504
"Same as a -= b.");
505
506
#define _OPERATOR_ISUB_METHODDEF    \
507
    {"isub", _PyCFunction_CAST(_operator_isub), METH_FASTCALL, _operator_isub__doc__},
508
509
static PyObject *
510
_operator_isub_impl(PyObject *module, PyObject *a, PyObject *b);
511
512
static PyObject *
513
_operator_isub(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
514
0
{
515
0
    PyObject *return_value = NULL;
516
0
    PyObject *a;
517
0
    PyObject *b;
518
519
0
    if (!_PyArg_CheckPositional("isub", nargs, 2, 2)) {
520
0
        goto exit;
521
0
    }
522
0
    a = args[0];
523
0
    b = args[1];
524
0
    return_value = _operator_isub_impl(module, a, b);
525
526
0
exit:
527
0
    return return_value;
528
0
}
529
530
PyDoc_STRVAR(_operator_imul__doc__,
531
"imul($module, a, b, /)\n"
532
"--\n"
533
"\n"
534
"Same as a *= b.");
535
536
#define _OPERATOR_IMUL_METHODDEF    \
537
    {"imul", _PyCFunction_CAST(_operator_imul), METH_FASTCALL, _operator_imul__doc__},
538
539
static PyObject *
540
_operator_imul_impl(PyObject *module, PyObject *a, PyObject *b);
541
542
static PyObject *
543
_operator_imul(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
544
0
{
545
0
    PyObject *return_value = NULL;
546
0
    PyObject *a;
547
0
    PyObject *b;
548
549
0
    if (!_PyArg_CheckPositional("imul", nargs, 2, 2)) {
550
0
        goto exit;
551
0
    }
552
0
    a = args[0];
553
0
    b = args[1];
554
0
    return_value = _operator_imul_impl(module, a, b);
555
556
0
exit:
557
0
    return return_value;
558
0
}
559
560
PyDoc_STRVAR(_operator_imatmul__doc__,
561
"imatmul($module, a, b, /)\n"
562
"--\n"
563
"\n"
564
"Same as a @= b.");
565
566
#define _OPERATOR_IMATMUL_METHODDEF    \
567
    {"imatmul", _PyCFunction_CAST(_operator_imatmul), METH_FASTCALL, _operator_imatmul__doc__},
568
569
static PyObject *
570
_operator_imatmul_impl(PyObject *module, PyObject *a, PyObject *b);
571
572
static PyObject *
573
_operator_imatmul(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
574
0
{
575
0
    PyObject *return_value = NULL;
576
0
    PyObject *a;
577
0
    PyObject *b;
578
579
0
    if (!_PyArg_CheckPositional("imatmul", nargs, 2, 2)) {
580
0
        goto exit;
581
0
    }
582
0
    a = args[0];
583
0
    b = args[1];
584
0
    return_value = _operator_imatmul_impl(module, a, b);
585
586
0
exit:
587
0
    return return_value;
588
0
}
589
590
PyDoc_STRVAR(_operator_ifloordiv__doc__,
591
"ifloordiv($module, a, b, /)\n"
592
"--\n"
593
"\n"
594
"Same as a //= b.");
595
596
#define _OPERATOR_IFLOORDIV_METHODDEF    \
597
    {"ifloordiv", _PyCFunction_CAST(_operator_ifloordiv), METH_FASTCALL, _operator_ifloordiv__doc__},
598
599
static PyObject *
600
_operator_ifloordiv_impl(PyObject *module, PyObject *a, PyObject *b);
601
602
static PyObject *
603
_operator_ifloordiv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
604
0
{
605
0
    PyObject *return_value = NULL;
606
0
    PyObject *a;
607
0
    PyObject *b;
608
609
0
    if (!_PyArg_CheckPositional("ifloordiv", nargs, 2, 2)) {
610
0
        goto exit;
611
0
    }
612
0
    a = args[0];
613
0
    b = args[1];
614
0
    return_value = _operator_ifloordiv_impl(module, a, b);
615
616
0
exit:
617
0
    return return_value;
618
0
}
619
620
PyDoc_STRVAR(_operator_itruediv__doc__,
621
"itruediv($module, a, b, /)\n"
622
"--\n"
623
"\n"
624
"Same as a /= b.");
625
626
#define _OPERATOR_ITRUEDIV_METHODDEF    \
627
    {"itruediv", _PyCFunction_CAST(_operator_itruediv), METH_FASTCALL, _operator_itruediv__doc__},
628
629
static PyObject *
630
_operator_itruediv_impl(PyObject *module, PyObject *a, PyObject *b);
631
632
static PyObject *
633
_operator_itruediv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
634
0
{
635
0
    PyObject *return_value = NULL;
636
0
    PyObject *a;
637
0
    PyObject *b;
638
639
0
    if (!_PyArg_CheckPositional("itruediv", nargs, 2, 2)) {
640
0
        goto exit;
641
0
    }
642
0
    a = args[0];
643
0
    b = args[1];
644
0
    return_value = _operator_itruediv_impl(module, a, b);
645
646
0
exit:
647
0
    return return_value;
648
0
}
649
650
PyDoc_STRVAR(_operator_imod__doc__,
651
"imod($module, a, b, /)\n"
652
"--\n"
653
"\n"
654
"Same as a %= b.");
655
656
#define _OPERATOR_IMOD_METHODDEF    \
657
    {"imod", _PyCFunction_CAST(_operator_imod), METH_FASTCALL, _operator_imod__doc__},
658
659
static PyObject *
660
_operator_imod_impl(PyObject *module, PyObject *a, PyObject *b);
661
662
static PyObject *
663
_operator_imod(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
664
0
{
665
0
    PyObject *return_value = NULL;
666
0
    PyObject *a;
667
0
    PyObject *b;
668
669
0
    if (!_PyArg_CheckPositional("imod", nargs, 2, 2)) {
670
0
        goto exit;
671
0
    }
672
0
    a = args[0];
673
0
    b = args[1];
674
0
    return_value = _operator_imod_impl(module, a, b);
675
676
0
exit:
677
0
    return return_value;
678
0
}
679
680
PyDoc_STRVAR(_operator_ilshift__doc__,
681
"ilshift($module, a, b, /)\n"
682
"--\n"
683
"\n"
684
"Same as a <<= b.");
685
686
#define _OPERATOR_ILSHIFT_METHODDEF    \
687
    {"ilshift", _PyCFunction_CAST(_operator_ilshift), METH_FASTCALL, _operator_ilshift__doc__},
688
689
static PyObject *
690
_operator_ilshift_impl(PyObject *module, PyObject *a, PyObject *b);
691
692
static PyObject *
693
_operator_ilshift(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
694
0
{
695
0
    PyObject *return_value = NULL;
696
0
    PyObject *a;
697
0
    PyObject *b;
698
699
0
    if (!_PyArg_CheckPositional("ilshift", nargs, 2, 2)) {
700
0
        goto exit;
701
0
    }
702
0
    a = args[0];
703
0
    b = args[1];
704
0
    return_value = _operator_ilshift_impl(module, a, b);
705
706
0
exit:
707
0
    return return_value;
708
0
}
709
710
PyDoc_STRVAR(_operator_irshift__doc__,
711
"irshift($module, a, b, /)\n"
712
"--\n"
713
"\n"
714
"Same as a >>= b.");
715
716
#define _OPERATOR_IRSHIFT_METHODDEF    \
717
    {"irshift", _PyCFunction_CAST(_operator_irshift), METH_FASTCALL, _operator_irshift__doc__},
718
719
static PyObject *
720
_operator_irshift_impl(PyObject *module, PyObject *a, PyObject *b);
721
722
static PyObject *
723
_operator_irshift(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
724
0
{
725
0
    PyObject *return_value = NULL;
726
0
    PyObject *a;
727
0
    PyObject *b;
728
729
0
    if (!_PyArg_CheckPositional("irshift", nargs, 2, 2)) {
730
0
        goto exit;
731
0
    }
732
0
    a = args[0];
733
0
    b = args[1];
734
0
    return_value = _operator_irshift_impl(module, a, b);
735
736
0
exit:
737
0
    return return_value;
738
0
}
739
740
PyDoc_STRVAR(_operator_iand__doc__,
741
"iand($module, a, b, /)\n"
742
"--\n"
743
"\n"
744
"Same as a &= b.");
745
746
#define _OPERATOR_IAND_METHODDEF    \
747
    {"iand", _PyCFunction_CAST(_operator_iand), METH_FASTCALL, _operator_iand__doc__},
748
749
static PyObject *
750
_operator_iand_impl(PyObject *module, PyObject *a, PyObject *b);
751
752
static PyObject *
753
_operator_iand(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
754
0
{
755
0
    PyObject *return_value = NULL;
756
0
    PyObject *a;
757
0
    PyObject *b;
758
759
0
    if (!_PyArg_CheckPositional("iand", nargs, 2, 2)) {
760
0
        goto exit;
761
0
    }
762
0
    a = args[0];
763
0
    b = args[1];
764
0
    return_value = _operator_iand_impl(module, a, b);
765
766
0
exit:
767
0
    return return_value;
768
0
}
769
770
PyDoc_STRVAR(_operator_ixor__doc__,
771
"ixor($module, a, b, /)\n"
772
"--\n"
773
"\n"
774
"Same as a ^= b.");
775
776
#define _OPERATOR_IXOR_METHODDEF    \
777
    {"ixor", _PyCFunction_CAST(_operator_ixor), METH_FASTCALL, _operator_ixor__doc__},
778
779
static PyObject *
780
_operator_ixor_impl(PyObject *module, PyObject *a, PyObject *b);
781
782
static PyObject *
783
_operator_ixor(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
784
0
{
785
0
    PyObject *return_value = NULL;
786
0
    PyObject *a;
787
0
    PyObject *b;
788
789
0
    if (!_PyArg_CheckPositional("ixor", nargs, 2, 2)) {
790
0
        goto exit;
791
0
    }
792
0
    a = args[0];
793
0
    b = args[1];
794
0
    return_value = _operator_ixor_impl(module, a, b);
795
796
0
exit:
797
0
    return return_value;
798
0
}
799
800
PyDoc_STRVAR(_operator_ior__doc__,
801
"ior($module, a, b, /)\n"
802
"--\n"
803
"\n"
804
"Same as a |= b.");
805
806
#define _OPERATOR_IOR_METHODDEF    \
807
    {"ior", _PyCFunction_CAST(_operator_ior), METH_FASTCALL, _operator_ior__doc__},
808
809
static PyObject *
810
_operator_ior_impl(PyObject *module, PyObject *a, PyObject *b);
811
812
static PyObject *
813
_operator_ior(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
814
0
{
815
0
    PyObject *return_value = NULL;
816
0
    PyObject *a;
817
0
    PyObject *b;
818
819
0
    if (!_PyArg_CheckPositional("ior", nargs, 2, 2)) {
820
0
        goto exit;
821
0
    }
822
0
    a = args[0];
823
0
    b = args[1];
824
0
    return_value = _operator_ior_impl(module, a, b);
825
826
0
exit:
827
0
    return return_value;
828
0
}
829
830
PyDoc_STRVAR(_operator_concat__doc__,
831
"concat($module, a, b, /)\n"
832
"--\n"
833
"\n"
834
"Same as a + b, for a and b sequences.");
835
836
#define _OPERATOR_CONCAT_METHODDEF    \
837
    {"concat", _PyCFunction_CAST(_operator_concat), METH_FASTCALL, _operator_concat__doc__},
838
839
static PyObject *
840
_operator_concat_impl(PyObject *module, PyObject *a, PyObject *b);
841
842
static PyObject *
843
_operator_concat(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
844
0
{
845
0
    PyObject *return_value = NULL;
846
0
    PyObject *a;
847
0
    PyObject *b;
848
849
0
    if (!_PyArg_CheckPositional("concat", nargs, 2, 2)) {
850
0
        goto exit;
851
0
    }
852
0
    a = args[0];
853
0
    b = args[1];
854
0
    return_value = _operator_concat_impl(module, a, b);
855
856
0
exit:
857
0
    return return_value;
858
0
}
859
860
PyDoc_STRVAR(_operator_iconcat__doc__,
861
"iconcat($module, a, b, /)\n"
862
"--\n"
863
"\n"
864
"Same as a += b, for a and b sequences.");
865
866
#define _OPERATOR_ICONCAT_METHODDEF    \
867
    {"iconcat", _PyCFunction_CAST(_operator_iconcat), METH_FASTCALL, _operator_iconcat__doc__},
868
869
static PyObject *
870
_operator_iconcat_impl(PyObject *module, PyObject *a, PyObject *b);
871
872
static PyObject *
873
_operator_iconcat(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
874
0
{
875
0
    PyObject *return_value = NULL;
876
0
    PyObject *a;
877
0
    PyObject *b;
878
879
0
    if (!_PyArg_CheckPositional("iconcat", nargs, 2, 2)) {
880
0
        goto exit;
881
0
    }
882
0
    a = args[0];
883
0
    b = args[1];
884
0
    return_value = _operator_iconcat_impl(module, a, b);
885
886
0
exit:
887
0
    return return_value;
888
0
}
889
890
PyDoc_STRVAR(_operator_contains__doc__,
891
"contains($module, a, b, /)\n"
892
"--\n"
893
"\n"
894
"Same as b in a (note reversed operands).");
895
896
#define _OPERATOR_CONTAINS_METHODDEF    \
897
    {"contains", _PyCFunction_CAST(_operator_contains), METH_FASTCALL, _operator_contains__doc__},
898
899
static int
900
_operator_contains_impl(PyObject *module, PyObject *a, PyObject *b);
901
902
static PyObject *
903
_operator_contains(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
904
0
{
905
0
    PyObject *return_value = NULL;
906
0
    PyObject *a;
907
0
    PyObject *b;
908
0
    int _return_value;
909
910
0
    if (!_PyArg_CheckPositional("contains", nargs, 2, 2)) {
911
0
        goto exit;
912
0
    }
913
0
    a = args[0];
914
0
    b = args[1];
915
0
    _return_value = _operator_contains_impl(module, a, b);
916
0
    if ((_return_value == -1) && PyErr_Occurred()) {
917
0
        goto exit;
918
0
    }
919
0
    return_value = PyBool_FromLong((long)_return_value);
920
921
0
exit:
922
0
    return return_value;
923
0
}
924
925
PyDoc_STRVAR(_operator_indexOf__doc__,
926
"indexOf($module, a, b, /)\n"
927
"--\n"
928
"\n"
929
"Return the first index of b in a.");
930
931
#define _OPERATOR_INDEXOF_METHODDEF    \
932
    {"indexOf", _PyCFunction_CAST(_operator_indexOf), METH_FASTCALL, _operator_indexOf__doc__},
933
934
static Py_ssize_t
935
_operator_indexOf_impl(PyObject *module, PyObject *a, PyObject *b);
936
937
static PyObject *
938
_operator_indexOf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
939
0
{
940
0
    PyObject *return_value = NULL;
941
0
    PyObject *a;
942
0
    PyObject *b;
943
0
    Py_ssize_t _return_value;
944
945
0
    if (!_PyArg_CheckPositional("indexOf", nargs, 2, 2)) {
946
0
        goto exit;
947
0
    }
948
0
    a = args[0];
949
0
    b = args[1];
950
0
    _return_value = _operator_indexOf_impl(module, a, b);
951
0
    if ((_return_value == -1) && PyErr_Occurred()) {
952
0
        goto exit;
953
0
    }
954
0
    return_value = PyLong_FromSsize_t(_return_value);
955
956
0
exit:
957
0
    return return_value;
958
0
}
959
960
PyDoc_STRVAR(_operator_countOf__doc__,
961
"countOf($module, a, b, /)\n"
962
"--\n"
963
"\n"
964
"Return the number of items in a which are, or which equal, b.");
965
966
#define _OPERATOR_COUNTOF_METHODDEF    \
967
    {"countOf", _PyCFunction_CAST(_operator_countOf), METH_FASTCALL, _operator_countOf__doc__},
968
969
static Py_ssize_t
970
_operator_countOf_impl(PyObject *module, PyObject *a, PyObject *b);
971
972
static PyObject *
973
_operator_countOf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
974
0
{
975
0
    PyObject *return_value = NULL;
976
0
    PyObject *a;
977
0
    PyObject *b;
978
0
    Py_ssize_t _return_value;
979
980
0
    if (!_PyArg_CheckPositional("countOf", nargs, 2, 2)) {
981
0
        goto exit;
982
0
    }
983
0
    a = args[0];
984
0
    b = args[1];
985
0
    _return_value = _operator_countOf_impl(module, a, b);
986
0
    if ((_return_value == -1) && PyErr_Occurred()) {
987
0
        goto exit;
988
0
    }
989
0
    return_value = PyLong_FromSsize_t(_return_value);
990
991
0
exit:
992
0
    return return_value;
993
0
}
994
995
PyDoc_STRVAR(_operator_getitem__doc__,
996
"getitem($module, a, b, /)\n"
997
"--\n"
998
"\n"
999
"Same as a[b].");
1000
1001
#define _OPERATOR_GETITEM_METHODDEF    \
1002
    {"getitem", _PyCFunction_CAST(_operator_getitem), METH_FASTCALL, _operator_getitem__doc__},
1003
1004
static PyObject *
1005
_operator_getitem_impl(PyObject *module, PyObject *a, PyObject *b);
1006
1007
static PyObject *
1008
_operator_getitem(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1009
0
{
1010
0
    PyObject *return_value = NULL;
1011
0
    PyObject *a;
1012
0
    PyObject *b;
1013
1014
0
    if (!_PyArg_CheckPositional("getitem", nargs, 2, 2)) {
1015
0
        goto exit;
1016
0
    }
1017
0
    a = args[0];
1018
0
    b = args[1];
1019
0
    return_value = _operator_getitem_impl(module, a, b);
1020
1021
0
exit:
1022
0
    return return_value;
1023
0
}
1024
1025
PyDoc_STRVAR(_operator_setitem__doc__,
1026
"setitem($module, a, b, c, /)\n"
1027
"--\n"
1028
"\n"
1029
"Same as a[b] = c.");
1030
1031
#define _OPERATOR_SETITEM_METHODDEF    \
1032
    {"setitem", _PyCFunction_CAST(_operator_setitem), METH_FASTCALL, _operator_setitem__doc__},
1033
1034
static PyObject *
1035
_operator_setitem_impl(PyObject *module, PyObject *a, PyObject *b,
1036
                       PyObject *c);
1037
1038
static PyObject *
1039
_operator_setitem(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1040
0
{
1041
0
    PyObject *return_value = NULL;
1042
0
    PyObject *a;
1043
0
    PyObject *b;
1044
0
    PyObject *c;
1045
1046
0
    if (!_PyArg_CheckPositional("setitem", nargs, 3, 3)) {
1047
0
        goto exit;
1048
0
    }
1049
0
    a = args[0];
1050
0
    b = args[1];
1051
0
    c = args[2];
1052
0
    return_value = _operator_setitem_impl(module, a, b, c);
1053
1054
0
exit:
1055
0
    return return_value;
1056
0
}
1057
1058
PyDoc_STRVAR(_operator_delitem__doc__,
1059
"delitem($module, a, b, /)\n"
1060
"--\n"
1061
"\n"
1062
"Same as del a[b].");
1063
1064
#define _OPERATOR_DELITEM_METHODDEF    \
1065
    {"delitem", _PyCFunction_CAST(_operator_delitem), METH_FASTCALL, _operator_delitem__doc__},
1066
1067
static PyObject *
1068
_operator_delitem_impl(PyObject *module, PyObject *a, PyObject *b);
1069
1070
static PyObject *
1071
_operator_delitem(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1072
0
{
1073
0
    PyObject *return_value = NULL;
1074
0
    PyObject *a;
1075
0
    PyObject *b;
1076
1077
0
    if (!_PyArg_CheckPositional("delitem", nargs, 2, 2)) {
1078
0
        goto exit;
1079
0
    }
1080
0
    a = args[0];
1081
0
    b = args[1];
1082
0
    return_value = _operator_delitem_impl(module, a, b);
1083
1084
0
exit:
1085
0
    return return_value;
1086
0
}
1087
1088
PyDoc_STRVAR(_operator_eq__doc__,
1089
"eq($module, a, b, /)\n"
1090
"--\n"
1091
"\n"
1092
"Same as a == b.");
1093
1094
#define _OPERATOR_EQ_METHODDEF    \
1095
    {"eq", _PyCFunction_CAST(_operator_eq), METH_FASTCALL, _operator_eq__doc__},
1096
1097
static PyObject *
1098
_operator_eq_impl(PyObject *module, PyObject *a, PyObject *b);
1099
1100
static PyObject *
1101
_operator_eq(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1102
16
{
1103
16
    PyObject *return_value = NULL;
1104
16
    PyObject *a;
1105
16
    PyObject *b;
1106
1107
16
    if (!_PyArg_CheckPositional("eq", nargs, 2, 2)) {
1108
0
        goto exit;
1109
0
    }
1110
16
    a = args[0];
1111
16
    b = args[1];
1112
16
    return_value = _operator_eq_impl(module, a, b);
1113
1114
16
exit:
1115
16
    return return_value;
1116
16
}
1117
1118
PyDoc_STRVAR(_operator_ne__doc__,
1119
"ne($module, a, b, /)\n"
1120
"--\n"
1121
"\n"
1122
"Same as a != b.");
1123
1124
#define _OPERATOR_NE_METHODDEF    \
1125
    {"ne", _PyCFunction_CAST(_operator_ne), METH_FASTCALL, _operator_ne__doc__},
1126
1127
static PyObject *
1128
_operator_ne_impl(PyObject *module, PyObject *a, PyObject *b);
1129
1130
static PyObject *
1131
_operator_ne(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1132
0
{
1133
0
    PyObject *return_value = NULL;
1134
0
    PyObject *a;
1135
0
    PyObject *b;
1136
1137
0
    if (!_PyArg_CheckPositional("ne", nargs, 2, 2)) {
1138
0
        goto exit;
1139
0
    }
1140
0
    a = args[0];
1141
0
    b = args[1];
1142
0
    return_value = _operator_ne_impl(module, a, b);
1143
1144
0
exit:
1145
0
    return return_value;
1146
0
}
1147
1148
PyDoc_STRVAR(_operator_lt__doc__,
1149
"lt($module, a, b, /)\n"
1150
"--\n"
1151
"\n"
1152
"Same as a < b.");
1153
1154
#define _OPERATOR_LT_METHODDEF    \
1155
    {"lt", _PyCFunction_CAST(_operator_lt), METH_FASTCALL, _operator_lt__doc__},
1156
1157
static PyObject *
1158
_operator_lt_impl(PyObject *module, PyObject *a, PyObject *b);
1159
1160
static PyObject *
1161
_operator_lt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1162
0
{
1163
0
    PyObject *return_value = NULL;
1164
0
    PyObject *a;
1165
0
    PyObject *b;
1166
1167
0
    if (!_PyArg_CheckPositional("lt", nargs, 2, 2)) {
1168
0
        goto exit;
1169
0
    }
1170
0
    a = args[0];
1171
0
    b = args[1];
1172
0
    return_value = _operator_lt_impl(module, a, b);
1173
1174
0
exit:
1175
0
    return return_value;
1176
0
}
1177
1178
PyDoc_STRVAR(_operator_le__doc__,
1179
"le($module, a, b, /)\n"
1180
"--\n"
1181
"\n"
1182
"Same as a <= b.");
1183
1184
#define _OPERATOR_LE_METHODDEF    \
1185
    {"le", _PyCFunction_CAST(_operator_le), METH_FASTCALL, _operator_le__doc__},
1186
1187
static PyObject *
1188
_operator_le_impl(PyObject *module, PyObject *a, PyObject *b);
1189
1190
static PyObject *
1191
_operator_le(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1192
0
{
1193
0
    PyObject *return_value = NULL;
1194
0
    PyObject *a;
1195
0
    PyObject *b;
1196
1197
0
    if (!_PyArg_CheckPositional("le", nargs, 2, 2)) {
1198
0
        goto exit;
1199
0
    }
1200
0
    a = args[0];
1201
0
    b = args[1];
1202
0
    return_value = _operator_le_impl(module, a, b);
1203
1204
0
exit:
1205
0
    return return_value;
1206
0
}
1207
1208
PyDoc_STRVAR(_operator_gt__doc__,
1209
"gt($module, a, b, /)\n"
1210
"--\n"
1211
"\n"
1212
"Same as a > b.");
1213
1214
#define _OPERATOR_GT_METHODDEF    \
1215
    {"gt", _PyCFunction_CAST(_operator_gt), METH_FASTCALL, _operator_gt__doc__},
1216
1217
static PyObject *
1218
_operator_gt_impl(PyObject *module, PyObject *a, PyObject *b);
1219
1220
static PyObject *
1221
_operator_gt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1222
0
{
1223
0
    PyObject *return_value = NULL;
1224
0
    PyObject *a;
1225
0
    PyObject *b;
1226
1227
0
    if (!_PyArg_CheckPositional("gt", nargs, 2, 2)) {
1228
0
        goto exit;
1229
0
    }
1230
0
    a = args[0];
1231
0
    b = args[1];
1232
0
    return_value = _operator_gt_impl(module, a, b);
1233
1234
0
exit:
1235
0
    return return_value;
1236
0
}
1237
1238
PyDoc_STRVAR(_operator_ge__doc__,
1239
"ge($module, a, b, /)\n"
1240
"--\n"
1241
"\n"
1242
"Same as a >= b.");
1243
1244
#define _OPERATOR_GE_METHODDEF    \
1245
    {"ge", _PyCFunction_CAST(_operator_ge), METH_FASTCALL, _operator_ge__doc__},
1246
1247
static PyObject *
1248
_operator_ge_impl(PyObject *module, PyObject *a, PyObject *b);
1249
1250
static PyObject *
1251
_operator_ge(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1252
0
{
1253
0
    PyObject *return_value = NULL;
1254
0
    PyObject *a;
1255
0
    PyObject *b;
1256
1257
0
    if (!_PyArg_CheckPositional("ge", nargs, 2, 2)) {
1258
0
        goto exit;
1259
0
    }
1260
0
    a = args[0];
1261
0
    b = args[1];
1262
0
    return_value = _operator_ge_impl(module, a, b);
1263
1264
0
exit:
1265
0
    return return_value;
1266
0
}
1267
1268
PyDoc_STRVAR(_operator_pow__doc__,
1269
"pow($module, a, b, /)\n"
1270
"--\n"
1271
"\n"
1272
"Same as a ** b.");
1273
1274
#define _OPERATOR_POW_METHODDEF    \
1275
    {"pow", _PyCFunction_CAST(_operator_pow), METH_FASTCALL, _operator_pow__doc__},
1276
1277
static PyObject *
1278
_operator_pow_impl(PyObject *module, PyObject *a, PyObject *b);
1279
1280
static PyObject *
1281
_operator_pow(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1282
0
{
1283
0
    PyObject *return_value = NULL;
1284
0
    PyObject *a;
1285
0
    PyObject *b;
1286
1287
0
    if (!_PyArg_CheckPositional("pow", nargs, 2, 2)) {
1288
0
        goto exit;
1289
0
    }
1290
0
    a = args[0];
1291
0
    b = args[1];
1292
0
    return_value = _operator_pow_impl(module, a, b);
1293
1294
0
exit:
1295
0
    return return_value;
1296
0
}
1297
1298
PyDoc_STRVAR(_operator_ipow__doc__,
1299
"ipow($module, a, b, /)\n"
1300
"--\n"
1301
"\n"
1302
"Same as a **= b.");
1303
1304
#define _OPERATOR_IPOW_METHODDEF    \
1305
    {"ipow", _PyCFunction_CAST(_operator_ipow), METH_FASTCALL, _operator_ipow__doc__},
1306
1307
static PyObject *
1308
_operator_ipow_impl(PyObject *module, PyObject *a, PyObject *b);
1309
1310
static PyObject *
1311
_operator_ipow(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1312
0
{
1313
0
    PyObject *return_value = NULL;
1314
0
    PyObject *a;
1315
0
    PyObject *b;
1316
1317
0
    if (!_PyArg_CheckPositional("ipow", nargs, 2, 2)) {
1318
0
        goto exit;
1319
0
    }
1320
0
    a = args[0];
1321
0
    b = args[1];
1322
0
    return_value = _operator_ipow_impl(module, a, b);
1323
1324
0
exit:
1325
0
    return return_value;
1326
0
}
1327
1328
PyDoc_STRVAR(_operator_index__doc__,
1329
"index($module, a, /)\n"
1330
"--\n"
1331
"\n"
1332
"Same as a.__index__()");
1333
1334
#define _OPERATOR_INDEX_METHODDEF    \
1335
    {"index", (PyCFunction)_operator_index, METH_O, _operator_index__doc__},
1336
1337
PyDoc_STRVAR(_operator_is___doc__,
1338
"is_($module, a, b, /)\n"
1339
"--\n"
1340
"\n"
1341
"Same as a is b.");
1342
1343
#define _OPERATOR_IS__METHODDEF    \
1344
    {"is_", _PyCFunction_CAST(_operator_is_), METH_FASTCALL, _operator_is___doc__},
1345
1346
static PyObject *
1347
_operator_is__impl(PyObject *module, PyObject *a, PyObject *b);
1348
1349
static PyObject *
1350
_operator_is_(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1351
0
{
1352
0
    PyObject *return_value = NULL;
1353
0
    PyObject *a;
1354
0
    PyObject *b;
1355
1356
0
    if (!_PyArg_CheckPositional("is_", nargs, 2, 2)) {
1357
0
        goto exit;
1358
0
    }
1359
0
    a = args[0];
1360
0
    b = args[1];
1361
0
    return_value = _operator_is__impl(module, a, b);
1362
1363
0
exit:
1364
0
    return return_value;
1365
0
}
1366
1367
PyDoc_STRVAR(_operator_is_not__doc__,
1368
"is_not($module, a, b, /)\n"
1369
"--\n"
1370
"\n"
1371
"Same as a is not b.");
1372
1373
#define _OPERATOR_IS_NOT_METHODDEF    \
1374
    {"is_not", _PyCFunction_CAST(_operator_is_not), METH_FASTCALL, _operator_is_not__doc__},
1375
1376
static PyObject *
1377
_operator_is_not_impl(PyObject *module, PyObject *a, PyObject *b);
1378
1379
static PyObject *
1380
_operator_is_not(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1381
0
{
1382
0
    PyObject *return_value = NULL;
1383
0
    PyObject *a;
1384
0
    PyObject *b;
1385
1386
0
    if (!_PyArg_CheckPositional("is_not", nargs, 2, 2)) {
1387
0
        goto exit;
1388
0
    }
1389
0
    a = args[0];
1390
0
    b = args[1];
1391
0
    return_value = _operator_is_not_impl(module, a, b);
1392
1393
0
exit:
1394
0
    return return_value;
1395
0
}
1396
1397
PyDoc_STRVAR(_operator_is_none__doc__,
1398
"is_none($module, a, /)\n"
1399
"--\n"
1400
"\n"
1401
"Same as a is None.");
1402
1403
#define _OPERATOR_IS_NONE_METHODDEF    \
1404
    {"is_none", (PyCFunction)_operator_is_none, METH_O, _operator_is_none__doc__},
1405
1406
PyDoc_STRVAR(_operator_is_not_none__doc__,
1407
"is_not_none($module, a, /)\n"
1408
"--\n"
1409
"\n"
1410
"Same as a is not None.");
1411
1412
#define _OPERATOR_IS_NOT_NONE_METHODDEF    \
1413
    {"is_not_none", (PyCFunction)_operator_is_not_none, METH_O, _operator_is_not_none__doc__},
1414
1415
PyDoc_STRVAR(_operator_length_hint__doc__,
1416
"length_hint($module, obj, default=0, /)\n"
1417
"--\n"
1418
"\n"
1419
"Return an estimate of the number of items in obj.\n"
1420
"\n"
1421
"This is useful for presizing containers when building from an iterable.\n"
1422
"\n"
1423
"If the object supports len(), the result will be exact.\n"
1424
"Otherwise, it may over- or under-estimate by an arbitrary amount.\n"
1425
"The result will be an integer >= 0.");
1426
1427
#define _OPERATOR_LENGTH_HINT_METHODDEF    \
1428
    {"length_hint", _PyCFunction_CAST(_operator_length_hint), METH_FASTCALL, _operator_length_hint__doc__},
1429
1430
static Py_ssize_t
1431
_operator_length_hint_impl(PyObject *module, PyObject *obj,
1432
                           Py_ssize_t default_value);
1433
1434
static PyObject *
1435
_operator_length_hint(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1436
0
{
1437
0
    PyObject *return_value = NULL;
1438
0
    PyObject *obj;
1439
0
    Py_ssize_t default_value = 0;
1440
0
    Py_ssize_t _return_value;
1441
1442
0
    if (!_PyArg_CheckPositional("length_hint", nargs, 1, 2)) {
1443
0
        goto exit;
1444
0
    }
1445
0
    obj = args[0];
1446
0
    if (nargs < 2) {
1447
0
        goto skip_optional;
1448
0
    }
1449
0
    {
1450
0
        Py_ssize_t ival = -1;
1451
0
        PyObject *iobj = _PyNumber_Index(args[1]);
1452
0
        if (iobj != NULL) {
1453
0
            ival = PyLong_AsSsize_t(iobj);
1454
0
            Py_DECREF(iobj);
1455
0
        }
1456
0
        if (ival == -1 && PyErr_Occurred()) {
1457
0
            goto exit;
1458
0
        }
1459
0
        default_value = ival;
1460
0
    }
1461
0
skip_optional:
1462
0
    _return_value = _operator_length_hint_impl(module, obj, default_value);
1463
0
    if ((_return_value == -1) && PyErr_Occurred()) {
1464
0
        goto exit;
1465
0
    }
1466
0
    return_value = PyLong_FromSsize_t(_return_value);
1467
1468
0
exit:
1469
0
    return return_value;
1470
0
}
1471
1472
PyDoc_STRVAR(_operator__compare_digest__doc__,
1473
"_compare_digest($module, a, b, /)\n"
1474
"--\n"
1475
"\n"
1476
"Return \'a == b\'.\n"
1477
"\n"
1478
"This function uses an approach designed to prevent\n"
1479
"timing analysis, making it appropriate for cryptography.\n"
1480
"\n"
1481
"a and b must both be of the same type: either str (ASCII only),\n"
1482
"or any bytes-like object.\n"
1483
"\n"
1484
"Note: If a and b are of different lengths, or if an error occurs,\n"
1485
"a timing attack could theoretically reveal information about the\n"
1486
"types and lengths of a and b--but not their values.");
1487
1488
#define _OPERATOR__COMPARE_DIGEST_METHODDEF    \
1489
    {"_compare_digest", _PyCFunction_CAST(_operator__compare_digest), METH_FASTCALL, _operator__compare_digest__doc__},
1490
1491
static PyObject *
1492
_operator__compare_digest_impl(PyObject *module, PyObject *a, PyObject *b);
1493
1494
static PyObject *
1495
_operator__compare_digest(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1496
0
{
1497
0
    PyObject *return_value = NULL;
1498
0
    PyObject *a;
1499
0
    PyObject *b;
1500
1501
0
    if (!_PyArg_CheckPositional("_compare_digest", nargs, 2, 2)) {
1502
0
        goto exit;
1503
0
    }
1504
0
    a = args[0];
1505
0
    b = args[1];
1506
0
    return_value = _operator__compare_digest_impl(module, a, b);
1507
1508
0
exit:
1509
0
    return return_value;
1510
0
}
1511
1512
static PyObject *
1513
itemgetter_type_new_impl(PyTypeObject *type, PyObject * const *items,
1514
                         Py_ssize_t items_length);
1515
1516
static PyObject *
1517
itemgetter_type_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1518
0
{
1519
0
    PyObject *return_value = NULL;
1520
0
    PyTypeObject *base_tp = type;
1521
0
    PyObject * const *items;
1522
0
    Py_ssize_t items_length;
1523
1524
0
    if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
1525
0
        !_PyArg_NoKeywords("itemgetter", kwargs)) {
1526
0
        goto exit;
1527
0
    }
1528
0
    items = _PyTuple_ITEMS(args);
1529
0
    items_length = PyTuple_GET_SIZE(args);
1530
0
    return_value = itemgetter_type_new_impl(type, items, items_length);
1531
1532
0
exit:
1533
0
    return return_value;
1534
0
}
1535
1536
static PyObject *
1537
itemgetter_type_vectorcall(PyObject *type, PyObject *const *args,
1538
    size_t nargsf, PyObject *kwnames)
1539
346k
{
1540
346k
    PyObject *return_value = NULL;
1541
346k
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
1542
346k
    PyObject * const *items;
1543
346k
    Py_ssize_t items_length;
1544
1545
346k
    assert(_PyType_CAST(type)->tp_new == itemgetter_type_new);
1546
    /* Make sure the type object is immutable: the generated
1547
     * vectorcall doesn't deal e.g. with users reassigning __init__. */
1548
346k
    assert(PyType_HasFeature(_PyType_CAST(type), Py_TPFLAGS_IMMUTABLETYPE));
1549
346k
    if (!_PyArg_NoKwnames("itemgetter", kwnames)) {
1550
0
        goto exit;
1551
0
    }
1552
346k
    items = args;
1553
346k
    items_length = nargs;
1554
346k
    return_value = itemgetter_type_new_impl(_PyType_CAST(type), items, items_length);
1555
1556
346k
exit:
1557
346k
    return return_value;
1558
346k
}
1559
1560
static PyObject *
1561
attrgetter_type_new_impl(PyTypeObject *type, PyObject * const *attrs,
1562
                         Py_ssize_t attrs_length);
1563
1564
static PyObject *
1565
attrgetter_type_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1566
0
{
1567
0
    PyObject *return_value = NULL;
1568
0
    PyTypeObject *base_tp = type;
1569
0
    PyObject * const *attrs;
1570
0
    Py_ssize_t attrs_length;
1571
1572
0
    if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
1573
0
        !_PyArg_NoKeywords("attrgetter", kwargs)) {
1574
0
        goto exit;
1575
0
    }
1576
0
    attrs = _PyTuple_ITEMS(args);
1577
0
    attrs_length = PyTuple_GET_SIZE(args);
1578
0
    return_value = attrgetter_type_new_impl(type, attrs, attrs_length);
1579
1580
0
exit:
1581
0
    return return_value;
1582
0
}
1583
1584
static PyObject *
1585
attrgetter_type_vectorcall(PyObject *type, PyObject *const *args,
1586
    size_t nargsf, PyObject *kwnames)
1587
4
{
1588
4
    PyObject *return_value = NULL;
1589
4
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
1590
4
    PyObject * const *attrs;
1591
4
    Py_ssize_t attrs_length;
1592
1593
4
    assert(_PyType_CAST(type)->tp_new == attrgetter_type_new);
1594
    /* Make sure the type object is immutable: the generated
1595
     * vectorcall doesn't deal e.g. with users reassigning __init__. */
1596
4
    assert(PyType_HasFeature(_PyType_CAST(type), Py_TPFLAGS_IMMUTABLETYPE));
1597
4
    if (!_PyArg_NoKwnames("attrgetter", kwnames)) {
1598
0
        goto exit;
1599
0
    }
1600
4
    attrs = args;
1601
4
    attrs_length = nargs;
1602
4
    return_value = attrgetter_type_new_impl(_PyType_CAST(type), attrs, attrs_length);
1603
1604
4
exit:
1605
4
    return return_value;
1606
4
}
1607
/*[clinic end generated code: output=a009773fbb99d7f3 input=a9049054013a1b77]*/