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)(void(*)(void))_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_CheckPositional("add", nargs, 2, 2)) {
53 goto exit;
54 }
55 a = args[0];
56 b = args[1];
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)(void(*)(void))_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_CheckPositional("sub", nargs, 2, 2)) {
83 goto exit;
84 }
85 a = args[0];
86 b = args[1];
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)(void(*)(void))_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_CheckPositional("mul", nargs, 2, 2)) {
113 goto exit;
114 }
115 a = args[0];
116 b = args[1];
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)(void(*)(void))_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_CheckPositional("matmul", nargs, 2, 2)) {
143 goto exit;
144 }
145 a = args[0];
146 b = args[1];
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)(void(*)(void))_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_CheckPositional("floordiv", nargs, 2, 2)) {
173 goto exit;
174 }
175 a = args[0];
176 b = args[1];
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)(void(*)(void))_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_CheckPositional("truediv", nargs, 2, 2)) {
203 goto exit;
204 }
205 a = args[0];
206 b = args[1];
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)(void(*)(void))_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_CheckPositional("mod", nargs, 2, 2)) {
233 goto exit;
234 }
235 a = args[0];
236 b = args[1];
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)(void(*)(void))_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_CheckPositional("lshift", nargs, 2, 2)) {
308 goto exit;
309 }
310 a = args[0];
311 b = args[1];
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)(void(*)(void))_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_CheckPositional("rshift", nargs, 2, 2)) {
338 goto exit;
339 }
340 a = args[0];
341 b = args[1];
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)(void(*)(void))_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_CheckPositional("and_", nargs, 2, 2)) {
396 goto exit;
397 }
398 a = args[0];
399 b = args[1];
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)(void(*)(void))_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_CheckPositional("xor", nargs, 2, 2)) {
426 goto exit;
427 }
428 a = args[0];
429 b = args[1];
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)(void(*)(void))_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_CheckPositional("or_", nargs, 2, 2)) {
456 goto exit;
457 }
458 a = args[0];
459 b = args[1];
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)(void(*)(void))_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_CheckPositional("iadd", nargs, 2, 2)) {
486 goto exit;
487 }
488 a = args[0];
489 b = args[1];
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)(void(*)(void))_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_CheckPositional("isub", nargs, 2, 2)) {
516 goto exit;
517 }
518 a = args[0];
519 b = args[1];
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)(void(*)(void))_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_CheckPositional("imul", nargs, 2, 2)) {
546 goto exit;
547 }
548 a = args[0];
549 b = args[1];
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)(void(*)(void))_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_CheckPositional("imatmul", nargs, 2, 2)) {
576 goto exit;
577 }
578 a = args[0];
579 b = args[1];
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)(void(*)(void))_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_CheckPositional("ifloordiv", nargs, 2, 2)) {
606 goto exit;
607 }
608 a = args[0];
609 b = args[1];
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)(void(*)(void))_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_CheckPositional("itruediv", nargs, 2, 2)) {
636 goto exit;
637 }
638 a = args[0];
639 b = args[1];
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)(void(*)(void))_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_CheckPositional("imod", nargs, 2, 2)) {
666 goto exit;
667 }
668 a = args[0];
669 b = args[1];
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)(void(*)(void))_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_CheckPositional("ilshift", nargs, 2, 2)) {
696 goto exit;
697 }
698 a = args[0];
699 b = args[1];
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)(void(*)(void))_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_CheckPositional("irshift", nargs, 2, 2)) {
726 goto exit;
727 }
728 a = args[0];
729 b = args[1];
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)(void(*)(void))_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_CheckPositional("iand", nargs, 2, 2)) {
756 goto exit;
757 }
758 a = args[0];
759 b = args[1];
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)(void(*)(void))_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_CheckPositional("ixor", nargs, 2, 2)) {
786 goto exit;
787 }
788 a = args[0];
789 b = args[1];
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)(void(*)(void))_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_CheckPositional("ior", nargs, 2, 2)) {
816 goto exit;
817 }
818 a = args[0];
819 b = args[1];
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)(void(*)(void))_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_CheckPositional("concat", nargs, 2, 2)) {
846 goto exit;
847 }
848 a = args[0];
849 b = args[1];
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)(void(*)(void))_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_CheckPositional("iconcat", nargs, 2, 2)) {
876 goto exit;
877 }
878 a = args[0];
879 b = args[1];
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)(void(*)(void))_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_CheckPositional("contains", nargs, 2, 2)) {
907 goto exit;
908 }
909 a = args[0];
910 b = args[1];
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)(void(*)(void))_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_CheckPositional("indexOf", nargs, 2, 2)) {
942 goto exit;
943 }
944 a = args[0];
945 b = args[1];
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)(void(*)(void))_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_CheckPositional("countOf", nargs, 2, 2)) {
977 goto exit;
978 }
979 a = args[0];
980 b = args[1];
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)(void(*)(void))_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_CheckPositional("getitem", nargs, 2, 2)) {
1011 goto exit;
1012 }
1013 a = args[0];
1014 b = args[1];
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)(void(*)(void))_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_CheckPositional("setitem", nargs, 3, 3)) {
1043 goto exit;
1044 }
1045 a = args[0];
1046 b = args[1];
1047 c = args[2];
1048 return_value = _operator_setitem_impl(module, a, b, c);
1049
1050 exit:
1051 return return_value;
1052 }
1053
1054 PyDoc_STRVAR(_operator_delitem__doc__,
1055 "delitem($module, a, b, /)\n"
1056 "--\n"
1057 "\n"
1058 "Same as del a[b].");
1059
1060 #define _OPERATOR_DELITEM_METHODDEF \
1061 {"delitem", (PyCFunction)(void(*)(void))_operator_delitem, METH_FASTCALL, _operator_delitem__doc__},
1062
1063 static PyObject *
1064 _operator_delitem_impl(PyObject *module, PyObject *a, PyObject *b);
1065
1066 static PyObject *
_operator_delitem(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1067 _operator_delitem(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1068 {
1069 PyObject *return_value = NULL;
1070 PyObject *a;
1071 PyObject *b;
1072
1073 if (!_PyArg_CheckPositional("delitem", nargs, 2, 2)) {
1074 goto exit;
1075 }
1076 a = args[0];
1077 b = args[1];
1078 return_value = _operator_delitem_impl(module, a, b);
1079
1080 exit:
1081 return return_value;
1082 }
1083
1084 PyDoc_STRVAR(_operator_eq__doc__,
1085 "eq($module, a, b, /)\n"
1086 "--\n"
1087 "\n"
1088 "Same as a == b.");
1089
1090 #define _OPERATOR_EQ_METHODDEF \
1091 {"eq", (PyCFunction)(void(*)(void))_operator_eq, METH_FASTCALL, _operator_eq__doc__},
1092
1093 static PyObject *
1094 _operator_eq_impl(PyObject *module, PyObject *a, PyObject *b);
1095
1096 static PyObject *
_operator_eq(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1097 _operator_eq(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1098 {
1099 PyObject *return_value = NULL;
1100 PyObject *a;
1101 PyObject *b;
1102
1103 if (!_PyArg_CheckPositional("eq", nargs, 2, 2)) {
1104 goto exit;
1105 }
1106 a = args[0];
1107 b = args[1];
1108 return_value = _operator_eq_impl(module, a, b);
1109
1110 exit:
1111 return return_value;
1112 }
1113
1114 PyDoc_STRVAR(_operator_ne__doc__,
1115 "ne($module, a, b, /)\n"
1116 "--\n"
1117 "\n"
1118 "Same as a != b.");
1119
1120 #define _OPERATOR_NE_METHODDEF \
1121 {"ne", (PyCFunction)(void(*)(void))_operator_ne, METH_FASTCALL, _operator_ne__doc__},
1122
1123 static PyObject *
1124 _operator_ne_impl(PyObject *module, PyObject *a, PyObject *b);
1125
1126 static PyObject *
_operator_ne(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1127 _operator_ne(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1128 {
1129 PyObject *return_value = NULL;
1130 PyObject *a;
1131 PyObject *b;
1132
1133 if (!_PyArg_CheckPositional("ne", nargs, 2, 2)) {
1134 goto exit;
1135 }
1136 a = args[0];
1137 b = args[1];
1138 return_value = _operator_ne_impl(module, a, b);
1139
1140 exit:
1141 return return_value;
1142 }
1143
1144 PyDoc_STRVAR(_operator_lt__doc__,
1145 "lt($module, a, b, /)\n"
1146 "--\n"
1147 "\n"
1148 "Same as a < b.");
1149
1150 #define _OPERATOR_LT_METHODDEF \
1151 {"lt", (PyCFunction)(void(*)(void))_operator_lt, METH_FASTCALL, _operator_lt__doc__},
1152
1153 static PyObject *
1154 _operator_lt_impl(PyObject *module, PyObject *a, PyObject *b);
1155
1156 static PyObject *
_operator_lt(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1157 _operator_lt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1158 {
1159 PyObject *return_value = NULL;
1160 PyObject *a;
1161 PyObject *b;
1162
1163 if (!_PyArg_CheckPositional("lt", nargs, 2, 2)) {
1164 goto exit;
1165 }
1166 a = args[0];
1167 b = args[1];
1168 return_value = _operator_lt_impl(module, a, b);
1169
1170 exit:
1171 return return_value;
1172 }
1173
1174 PyDoc_STRVAR(_operator_le__doc__,
1175 "le($module, a, b, /)\n"
1176 "--\n"
1177 "\n"
1178 "Same as a <= b.");
1179
1180 #define _OPERATOR_LE_METHODDEF \
1181 {"le", (PyCFunction)(void(*)(void))_operator_le, METH_FASTCALL, _operator_le__doc__},
1182
1183 static PyObject *
1184 _operator_le_impl(PyObject *module, PyObject *a, PyObject *b);
1185
1186 static PyObject *
_operator_le(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1187 _operator_le(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1188 {
1189 PyObject *return_value = NULL;
1190 PyObject *a;
1191 PyObject *b;
1192
1193 if (!_PyArg_CheckPositional("le", nargs, 2, 2)) {
1194 goto exit;
1195 }
1196 a = args[0];
1197 b = args[1];
1198 return_value = _operator_le_impl(module, a, b);
1199
1200 exit:
1201 return return_value;
1202 }
1203
1204 PyDoc_STRVAR(_operator_gt__doc__,
1205 "gt($module, a, b, /)\n"
1206 "--\n"
1207 "\n"
1208 "Same as a > b.");
1209
1210 #define _OPERATOR_GT_METHODDEF \
1211 {"gt", (PyCFunction)(void(*)(void))_operator_gt, METH_FASTCALL, _operator_gt__doc__},
1212
1213 static PyObject *
1214 _operator_gt_impl(PyObject *module, PyObject *a, PyObject *b);
1215
1216 static PyObject *
_operator_gt(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1217 _operator_gt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1218 {
1219 PyObject *return_value = NULL;
1220 PyObject *a;
1221 PyObject *b;
1222
1223 if (!_PyArg_CheckPositional("gt", nargs, 2, 2)) {
1224 goto exit;
1225 }
1226 a = args[0];
1227 b = args[1];
1228 return_value = _operator_gt_impl(module, a, b);
1229
1230 exit:
1231 return return_value;
1232 }
1233
1234 PyDoc_STRVAR(_operator_ge__doc__,
1235 "ge($module, a, b, /)\n"
1236 "--\n"
1237 "\n"
1238 "Same as a >= b.");
1239
1240 #define _OPERATOR_GE_METHODDEF \
1241 {"ge", (PyCFunction)(void(*)(void))_operator_ge, METH_FASTCALL, _operator_ge__doc__},
1242
1243 static PyObject *
1244 _operator_ge_impl(PyObject *module, PyObject *a, PyObject *b);
1245
1246 static PyObject *
_operator_ge(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1247 _operator_ge(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1248 {
1249 PyObject *return_value = NULL;
1250 PyObject *a;
1251 PyObject *b;
1252
1253 if (!_PyArg_CheckPositional("ge", nargs, 2, 2)) {
1254 goto exit;
1255 }
1256 a = args[0];
1257 b = args[1];
1258 return_value = _operator_ge_impl(module, a, b);
1259
1260 exit:
1261 return return_value;
1262 }
1263
1264 PyDoc_STRVAR(_operator_pow__doc__,
1265 "pow($module, a, b, /)\n"
1266 "--\n"
1267 "\n"
1268 "Same as a ** b.");
1269
1270 #define _OPERATOR_POW_METHODDEF \
1271 {"pow", (PyCFunction)(void(*)(void))_operator_pow, METH_FASTCALL, _operator_pow__doc__},
1272
1273 static PyObject *
1274 _operator_pow_impl(PyObject *module, PyObject *a, PyObject *b);
1275
1276 static PyObject *
_operator_pow(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1277 _operator_pow(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1278 {
1279 PyObject *return_value = NULL;
1280 PyObject *a;
1281 PyObject *b;
1282
1283 if (!_PyArg_CheckPositional("pow", nargs, 2, 2)) {
1284 goto exit;
1285 }
1286 a = args[0];
1287 b = args[1];
1288 return_value = _operator_pow_impl(module, a, b);
1289
1290 exit:
1291 return return_value;
1292 }
1293
1294 PyDoc_STRVAR(_operator_ipow__doc__,
1295 "ipow($module, a, b, /)\n"
1296 "--\n"
1297 "\n"
1298 "Same as a **= b.");
1299
1300 #define _OPERATOR_IPOW_METHODDEF \
1301 {"ipow", (PyCFunction)(void(*)(void))_operator_ipow, METH_FASTCALL, _operator_ipow__doc__},
1302
1303 static PyObject *
1304 _operator_ipow_impl(PyObject *module, PyObject *a, PyObject *b);
1305
1306 static PyObject *
_operator_ipow(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1307 _operator_ipow(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1308 {
1309 PyObject *return_value = NULL;
1310 PyObject *a;
1311 PyObject *b;
1312
1313 if (!_PyArg_CheckPositional("ipow", nargs, 2, 2)) {
1314 goto exit;
1315 }
1316 a = args[0];
1317 b = args[1];
1318 return_value = _operator_ipow_impl(module, a, b);
1319
1320 exit:
1321 return return_value;
1322 }
1323
1324 PyDoc_STRVAR(_operator_index__doc__,
1325 "index($module, a, /)\n"
1326 "--\n"
1327 "\n"
1328 "Same as a.__index__()");
1329
1330 #define _OPERATOR_INDEX_METHODDEF \
1331 {"index", (PyCFunction)_operator_index, METH_O, _operator_index__doc__},
1332
1333 PyDoc_STRVAR(_operator_is___doc__,
1334 "is_($module, a, b, /)\n"
1335 "--\n"
1336 "\n"
1337 "Same as a is b.");
1338
1339 #define _OPERATOR_IS__METHODDEF \
1340 {"is_", (PyCFunction)(void(*)(void))_operator_is_, METH_FASTCALL, _operator_is___doc__},
1341
1342 static PyObject *
1343 _operator_is__impl(PyObject *module, PyObject *a, PyObject *b);
1344
1345 static PyObject *
_operator_is_(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1346 _operator_is_(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1347 {
1348 PyObject *return_value = NULL;
1349 PyObject *a;
1350 PyObject *b;
1351
1352 if (!_PyArg_CheckPositional("is_", nargs, 2, 2)) {
1353 goto exit;
1354 }
1355 a = args[0];
1356 b = args[1];
1357 return_value = _operator_is__impl(module, a, b);
1358
1359 exit:
1360 return return_value;
1361 }
1362
1363 PyDoc_STRVAR(_operator_is_not__doc__,
1364 "is_not($module, a, b, /)\n"
1365 "--\n"
1366 "\n"
1367 "Same as a is not b.");
1368
1369 #define _OPERATOR_IS_NOT_METHODDEF \
1370 {"is_not", (PyCFunction)(void(*)(void))_operator_is_not, METH_FASTCALL, _operator_is_not__doc__},
1371
1372 static PyObject *
1373 _operator_is_not_impl(PyObject *module, PyObject *a, PyObject *b);
1374
1375 static PyObject *
_operator_is_not(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1376 _operator_is_not(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1377 {
1378 PyObject *return_value = NULL;
1379 PyObject *a;
1380 PyObject *b;
1381
1382 if (!_PyArg_CheckPositional("is_not", nargs, 2, 2)) {
1383 goto exit;
1384 }
1385 a = args[0];
1386 b = args[1];
1387 return_value = _operator_is_not_impl(module, a, b);
1388
1389 exit:
1390 return return_value;
1391 }
1392
1393 PyDoc_STRVAR(_operator_length_hint__doc__,
1394 "length_hint($module, obj, default=0, /)\n"
1395 "--\n"
1396 "\n"
1397 "Return an estimate of the number of items in obj.\n"
1398 "\n"
1399 "This is useful for presizing containers when building from an iterable.\n"
1400 "\n"
1401 "If the object supports len(), the result will be exact.\n"
1402 "Otherwise, it may over- or under-estimate by an arbitrary amount.\n"
1403 "The result will be an integer >= 0.");
1404
1405 #define _OPERATOR_LENGTH_HINT_METHODDEF \
1406 {"length_hint", (PyCFunction)(void(*)(void))_operator_length_hint, METH_FASTCALL, _operator_length_hint__doc__},
1407
1408 static Py_ssize_t
1409 _operator_length_hint_impl(PyObject *module, PyObject *obj,
1410 Py_ssize_t default_value);
1411
1412 static PyObject *
_operator_length_hint(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1413 _operator_length_hint(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1414 {
1415 PyObject *return_value = NULL;
1416 PyObject *obj;
1417 Py_ssize_t default_value = 0;
1418 Py_ssize_t _return_value;
1419
1420 if (!_PyArg_CheckPositional("length_hint", nargs, 1, 2)) {
1421 goto exit;
1422 }
1423 obj = args[0];
1424 if (nargs < 2) {
1425 goto skip_optional;
1426 }
1427 if (PyFloat_Check(args[1])) {
1428 PyErr_SetString(PyExc_TypeError,
1429 "integer argument expected, got float" );
1430 goto exit;
1431 }
1432 {
1433 Py_ssize_t ival = -1;
1434 PyObject *iobj = PyNumber_Index(args[1]);
1435 if (iobj != NULL) {
1436 ival = PyLong_AsSsize_t(iobj);
1437 Py_DECREF(iobj);
1438 }
1439 if (ival == -1 && PyErr_Occurred()) {
1440 goto exit;
1441 }
1442 default_value = ival;
1443 }
1444 skip_optional:
1445 _return_value = _operator_length_hint_impl(module, obj, default_value);
1446 if ((_return_value == -1) && PyErr_Occurred()) {
1447 goto exit;
1448 }
1449 return_value = PyLong_FromSsize_t(_return_value);
1450
1451 exit:
1452 return return_value;
1453 }
1454
1455 PyDoc_STRVAR(_operator__compare_digest__doc__,
1456 "_compare_digest($module, a, b, /)\n"
1457 "--\n"
1458 "\n"
1459 "Return \'a == b\'.\n"
1460 "\n"
1461 "This function uses an approach designed to prevent\n"
1462 "timing analysis, making it appropriate for cryptography.\n"
1463 "\n"
1464 "a and b must both be of the same type: either str (ASCII only),\n"
1465 "or any bytes-like object.\n"
1466 "\n"
1467 "Note: If a and b are of different lengths, or if an error occurs,\n"
1468 "a timing attack could theoretically reveal information about the\n"
1469 "types and lengths of a and b--but not their values.");
1470
1471 #define _OPERATOR__COMPARE_DIGEST_METHODDEF \
1472 {"_compare_digest", (PyCFunction)(void(*)(void))_operator__compare_digest, METH_FASTCALL, _operator__compare_digest__doc__},
1473
1474 static PyObject *
1475 _operator__compare_digest_impl(PyObject *module, PyObject *a, PyObject *b);
1476
1477 static PyObject *
_operator__compare_digest(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1478 _operator__compare_digest(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1479 {
1480 PyObject *return_value = NULL;
1481 PyObject *a;
1482 PyObject *b;
1483
1484 if (!_PyArg_CheckPositional("_compare_digest", nargs, 2, 2)) {
1485 goto exit;
1486 }
1487 a = args[0];
1488 b = args[1];
1489 return_value = _operator__compare_digest_impl(module, a, b);
1490
1491 exit:
1492 return return_value;
1493 }
1494 /*[clinic end generated code: output=e7ed71a8c475a901 input=a9049054013a1b77]*/
1495