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