7#include "nuitka/prelude.h"
10#include "HelpersOperationBinaryAddUtils.c"
13#if PYTHON_VERSION < 0x300
15static PyObject *_BINARY_OPERATION_ADD_OBJECT_INT_INT(PyObject *operand1, PyObject *operand2) {
16 CHECK_OBJECT(operand1);
17 assert(PyInt_CheckExact(operand1));
18 CHECK_OBJECT(operand2);
19 assert(PyInt_CheckExact(operand2));
26#pragma warning(disable : 4101)
28 NUITKA_MAY_BE_UNUSED
bool cbool_result;
29 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
30 NUITKA_MAY_BE_UNUSED
long clong_result;
31 NUITKA_MAY_BE_UNUSED
double cfloat_result;
36 CHECK_OBJECT(operand1);
37 assert(PyInt_CheckExact(operand1));
38 CHECK_OBJECT(operand2);
39 assert(PyInt_CheckExact(operand2));
41 const long a = PyInt_AS_LONG(operand1);
42 const long b = PyInt_AS_LONG(operand2);
44 const long x = (long)((
unsigned long)a + b);
45 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
46 if (likely(no_overflow)) {
48 goto exit_result_ok_clong;
52 PyObject *operand1_object = operand1;
53 PyObject *operand2_object = operand2;
55 PyObject *r = PyLong_Type.tp_as_number->nb_add(operand1_object, operand2_object);
56 assert(r != Py_NotImplemented);
59 goto exit_result_object;
63 result = Nuitka_PyInt_FromLong(clong_result);
67 if (unlikely(obj_result == NULL)) {
68 goto exit_result_exception;
80PyObject *BINARY_OPERATION_ADD_OBJECT_INT_INT(PyObject *operand1, PyObject *operand2) {
81 return _BINARY_OPERATION_ADD_OBJECT_INT_INT(operand1, operand2);
85#if PYTHON_VERSION < 0x300
87static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
88 PyTypeObject *type1 = Py_TYPE(operand1);
92#pragma warning(disable : 4101)
94 NUITKA_MAY_BE_UNUSED
bool cbool_result;
95 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
101 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
102 binaryfunc slot2 = NULL;
104 if (!(type1 == &PyInt_Type)) {
107 slot2 = PyInt_Type.tp_as_number->nb_add;
109 if (slot1 == slot2) {
115 PyObject *x = slot1(operand1, operand2);
117 if (x != Py_NotImplemented) {
119 goto exit_binary_result_object;
122 Py_DECREF_IMMORTAL(x);
126 PyObject *x = slot2(operand1, operand2);
128 if (x != Py_NotImplemented) {
130 goto exit_binary_result_object;
133 Py_DECREF_IMMORTAL(x);
136#if PYTHON_VERSION < 0x300
137 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
139 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
142 PyObject *coerced1 = operand1;
143 PyObject *coerced2 = operand2;
145 int err = c1(&coerced1, &coerced2);
147 if (unlikely(err < 0)) {
148 goto exit_binary_exception;
152 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
154 if (likely(mv == NULL)) {
155 binaryfunc slot = mv->nb_add;
157 if (likely(slot != NULL)) {
158 PyObject *x = slot(coerced1, coerced2);
164 goto exit_binary_result_object;
173 coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
176 PyObject *coerced1 = operand1;
177 PyObject *coerced2 = operand2;
179 int err = c2(&coerced2, &coerced1);
181 if (unlikely(err < 0)) {
182 goto exit_binary_exception;
186 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
188 if (likely(mv == NULL)) {
189 binaryfunc slot = mv->nb_add;
191 if (likely(slot != NULL)) {
192 PyObject *x = slot(coerced1, coerced2);
198 goto exit_binary_result_object;
212 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
214 if (sq_slot != NULL) {
215 PyObject *result = sq_slot(operand1, operand2);
218 goto exit_binary_result_object;
222 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'int'", type1->tp_name);
223 goto exit_binary_exception;
225exit_binary_result_object:
228exit_binary_exception:
231static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
232 CHECK_OBJECT(operand1);
233 CHECK_OBJECT(operand2);
234 assert(PyInt_CheckExact(operand2));
236 PyTypeObject *type1 = Py_TYPE(operand1);
238 if (type1 == &PyInt_Type) {
246#pragma warning(disable : 4101)
248 NUITKA_MAY_BE_UNUSED
bool cbool_result;
249 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
250 NUITKA_MAY_BE_UNUSED
long clong_result;
251 NUITKA_MAY_BE_UNUSED
double cfloat_result;
256 CHECK_OBJECT(operand1);
257 assert(PyInt_CheckExact(operand1));
258 CHECK_OBJECT(operand2);
259 assert(PyInt_CheckExact(operand2));
261 const long a = PyInt_AS_LONG(operand1);
262 const long b = PyInt_AS_LONG(operand2);
264 const long x = (long)((
unsigned long)a + b);
265 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
266 if (likely(no_overflow)) {
268 goto exit_result_ok_clong;
272 PyObject *operand1_object = operand1;
273 PyObject *operand2_object = operand2;
275 PyObject *r = PyLong_Type.tp_as_number->nb_add(operand1_object, operand2_object);
276 assert(r != Py_NotImplemented);
279 goto exit_result_object;
282 exit_result_ok_clong:
283 result = Nuitka_PyInt_FromLong(clong_result);
287 if (unlikely(obj_result == NULL)) {
288 goto exit_result_exception;
296 exit_result_exception:
300 return __BINARY_OPERATION_ADD_OBJECT_OBJECT_INT(operand1, operand2);
303PyObject *BINARY_OPERATION_ADD_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
304 return _BINARY_OPERATION_ADD_OBJECT_OBJECT_INT(operand1, operand2);
308#if PYTHON_VERSION < 0x300
310static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
311 PyTypeObject *type2 = Py_TYPE(operand2);
315#pragma warning(disable : 4101)
317 NUITKA_MAY_BE_UNUSED
bool cbool_result;
318 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
323 binaryfunc slot1 = PyInt_Type.tp_as_number->nb_add;
324 binaryfunc slot2 = NULL;
326 if (!(&PyInt_Type == type2)) {
329 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
331 if (slot1 == slot2) {
338 if (Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
339 PyObject *x = slot2(operand1, operand2);
341 if (x != Py_NotImplemented) {
343 goto exit_binary_result_object;
346 Py_DECREF_IMMORTAL(x);
351 PyObject *x = slot1(operand1, operand2);
353 if (x != Py_NotImplemented) {
355 goto exit_binary_result_object;
358 Py_DECREF_IMMORTAL(x);
362 PyObject *x = slot2(operand1, operand2);
364 if (x != Py_NotImplemented) {
366 goto exit_binary_result_object;
369 Py_DECREF_IMMORTAL(x);
372#if PYTHON_VERSION < 0x300
373 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
374 coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
377 PyObject *coerced1 = operand1;
378 PyObject *coerced2 = operand2;
380 int err = c1(&coerced1, &coerced2);
382 if (unlikely(err < 0)) {
383 goto exit_binary_exception;
387 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
389 if (likely(mv == NULL)) {
390 binaryfunc slot = mv->nb_add;
392 if (likely(slot != NULL)) {
393 PyObject *x = slot(coerced1, coerced2);
399 goto exit_binary_result_object;
409 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
412 PyObject *coerced1 = operand1;
413 PyObject *coerced2 = operand2;
415 int err = c2(&coerced2, &coerced1);
417 if (unlikely(err < 0)) {
418 goto exit_binary_exception;
422 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
424 if (likely(mv == NULL)) {
425 binaryfunc slot = mv->nb_add;
427 if (likely(slot != NULL)) {
428 PyObject *x = slot(coerced1, coerced2);
434 goto exit_binary_result_object;
450 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'int' and '%s'", type2->tp_name);
451 goto exit_binary_exception;
453exit_binary_result_object:
456exit_binary_exception:
459static PyObject *_BINARY_OPERATION_ADD_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
460 CHECK_OBJECT(operand1);
461 assert(PyInt_CheckExact(operand1));
462 CHECK_OBJECT(operand2);
464 PyTypeObject *type2 = Py_TYPE(operand2);
466 if (&PyInt_Type == type2) {
474#pragma warning(disable : 4101)
476 NUITKA_MAY_BE_UNUSED
bool cbool_result;
477 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
478 NUITKA_MAY_BE_UNUSED
long clong_result;
479 NUITKA_MAY_BE_UNUSED
double cfloat_result;
484 CHECK_OBJECT(operand1);
485 assert(PyInt_CheckExact(operand1));
486 CHECK_OBJECT(operand2);
487 assert(PyInt_CheckExact(operand2));
489 const long a = PyInt_AS_LONG(operand1);
490 const long b = PyInt_AS_LONG(operand2);
492 const long x = (long)((
unsigned long)a + b);
493 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
494 if (likely(no_overflow)) {
496 goto exit_result_ok_clong;
500 PyObject *operand1_object = operand1;
501 PyObject *operand2_object = operand2;
503 PyObject *r = PyLong_Type.tp_as_number->nb_add(operand1_object, operand2_object);
504 assert(r != Py_NotImplemented);
507 goto exit_result_object;
510 exit_result_ok_clong:
511 result = Nuitka_PyInt_FromLong(clong_result);
515 if (unlikely(obj_result == NULL)) {
516 goto exit_result_exception;
524 exit_result_exception:
528 return __BINARY_OPERATION_ADD_OBJECT_INT_OBJECT(operand1, operand2);
531PyObject *BINARY_OPERATION_ADD_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
532 return _BINARY_OPERATION_ADD_OBJECT_INT_OBJECT(operand1, operand2);
536#if PYTHON_VERSION < 0x300
538static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_INT_INT(PyObject *operand1, PyObject *operand2) {
539 CHECK_OBJECT(operand1);
540 assert(PyInt_CheckExact(operand1));
541 CHECK_OBJECT(operand2);
542 assert(PyInt_CheckExact(operand2));
549#pragma warning(disable : 4101)
551 NUITKA_MAY_BE_UNUSED
bool cbool_result;
552 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
553 NUITKA_MAY_BE_UNUSED
long clong_result;
554 NUITKA_MAY_BE_UNUSED
double cfloat_result;
559 CHECK_OBJECT(operand1);
560 assert(PyInt_CheckExact(operand1));
561 CHECK_OBJECT(operand2);
562 assert(PyInt_CheckExact(operand2));
564 const long a = PyInt_AS_LONG(operand1);
565 const long b = PyInt_AS_LONG(operand2);
567 const long x = (long)((
unsigned long)a + b);
568 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
569 bool t = !no_overflow || x != 0;
572 goto exit_result_ok_cbool;
575 result = cbool_result ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
582nuitka_bool BINARY_OPERATION_ADD_NBOOL_INT_INT(PyObject *operand1, PyObject *operand2) {
583 return _BINARY_OPERATION_ADD_NBOOL_INT_INT(operand1, operand2);
587#if PYTHON_VERSION < 0x300
589static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_ADD_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
590 PyTypeObject *type1 = Py_TYPE(operand1);
594#pragma warning(disable : 4101)
596 NUITKA_MAY_BE_UNUSED
bool cbool_result;
597 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
603 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
604 binaryfunc slot2 = NULL;
606 if (!(type1 == &PyInt_Type)) {
609 slot2 = PyInt_Type.tp_as_number->nb_add;
611 if (slot1 == slot2) {
617 PyObject *x = slot1(operand1, operand2);
619 if (x != Py_NotImplemented) {
621 goto exit_binary_result_object;
624 Py_DECREF_IMMORTAL(x);
628 PyObject *x = slot2(operand1, operand2);
630 if (x != Py_NotImplemented) {
632 goto exit_binary_result_object;
635 Py_DECREF_IMMORTAL(x);
638#if PYTHON_VERSION < 0x300
639 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
641 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
644 PyObject *coerced1 = operand1;
645 PyObject *coerced2 = operand2;
647 int err = c1(&coerced1, &coerced2);
649 if (unlikely(err < 0)) {
650 goto exit_binary_exception;
654 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
656 if (likely(mv == NULL)) {
657 binaryfunc slot = mv->nb_add;
659 if (likely(slot != NULL)) {
660 PyObject *x = slot(coerced1, coerced2);
666 goto exit_binary_result_object;
675 coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
678 PyObject *coerced1 = operand1;
679 PyObject *coerced2 = operand2;
681 int err = c2(&coerced2, &coerced1);
683 if (unlikely(err < 0)) {
684 goto exit_binary_exception;
688 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
690 if (likely(mv == NULL)) {
691 binaryfunc slot = mv->nb_add;
693 if (likely(slot != NULL)) {
694 PyObject *x = slot(coerced1, coerced2);
700 goto exit_binary_result_object;
714 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
716 if (sq_slot != NULL) {
717 PyObject *result = sq_slot(operand1, operand2);
720 goto exit_binary_result_object;
724 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'int'", type1->tp_name);
725 goto exit_binary_exception;
727exit_binary_result_object:
728 if (unlikely(obj_result == NULL)) {
729 return NUITKA_BOOL_EXCEPTION;
733 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
734 Py_DECREF(obj_result);
738exit_binary_exception:
739 return NUITKA_BOOL_EXCEPTION;
741static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
742 CHECK_OBJECT(operand1);
743 CHECK_OBJECT(operand2);
744 assert(PyInt_CheckExact(operand2));
746 PyTypeObject *type1 = Py_TYPE(operand1);
748 if (type1 == &PyInt_Type) {
756#pragma warning(disable : 4101)
758 NUITKA_MAY_BE_UNUSED
bool cbool_result;
759 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
760 NUITKA_MAY_BE_UNUSED
long clong_result;
761 NUITKA_MAY_BE_UNUSED
double cfloat_result;
766 CHECK_OBJECT(operand1);
767 assert(PyInt_CheckExact(operand1));
768 CHECK_OBJECT(operand2);
769 assert(PyInt_CheckExact(operand2));
771 const long a = PyInt_AS_LONG(operand1);
772 const long b = PyInt_AS_LONG(operand2);
774 const long x = (long)((
unsigned long)a + b);
775 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
776 bool t = !no_overflow || x != 0;
779 goto exit_result_ok_cbool;
781 exit_result_ok_cbool:
782 result = cbool_result ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
789 return __BINARY_OPERATION_ADD_NBOOL_OBJECT_INT(operand1, operand2);
792nuitka_bool BINARY_OPERATION_ADD_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
793 return _BINARY_OPERATION_ADD_NBOOL_OBJECT_INT(operand1, operand2);
797#if PYTHON_VERSION < 0x300
799static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_ADD_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
800 PyTypeObject *type2 = Py_TYPE(operand2);
804#pragma warning(disable : 4101)
806 NUITKA_MAY_BE_UNUSED
bool cbool_result;
807 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
812 binaryfunc slot1 = PyInt_Type.tp_as_number->nb_add;
813 binaryfunc slot2 = NULL;
815 if (!(&PyInt_Type == type2)) {
818 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
820 if (slot1 == slot2) {
827 if (Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
828 PyObject *x = slot2(operand1, operand2);
830 if (x != Py_NotImplemented) {
832 goto exit_binary_result_object;
835 Py_DECREF_IMMORTAL(x);
840 PyObject *x = slot1(operand1, operand2);
842 if (x != Py_NotImplemented) {
844 goto exit_binary_result_object;
847 Py_DECREF_IMMORTAL(x);
851 PyObject *x = slot2(operand1, operand2);
853 if (x != Py_NotImplemented) {
855 goto exit_binary_result_object;
858 Py_DECREF_IMMORTAL(x);
861#if PYTHON_VERSION < 0x300
862 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
863 coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
866 PyObject *coerced1 = operand1;
867 PyObject *coerced2 = operand2;
869 int err = c1(&coerced1, &coerced2);
871 if (unlikely(err < 0)) {
872 goto exit_binary_exception;
876 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
878 if (likely(mv == NULL)) {
879 binaryfunc slot = mv->nb_add;
881 if (likely(slot != NULL)) {
882 PyObject *x = slot(coerced1, coerced2);
888 goto exit_binary_result_object;
898 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
901 PyObject *coerced1 = operand1;
902 PyObject *coerced2 = operand2;
904 int err = c2(&coerced2, &coerced1);
906 if (unlikely(err < 0)) {
907 goto exit_binary_exception;
911 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
913 if (likely(mv == NULL)) {
914 binaryfunc slot = mv->nb_add;
916 if (likely(slot != NULL)) {
917 PyObject *x = slot(coerced1, coerced2);
923 goto exit_binary_result_object;
939 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'int' and '%s'", type2->tp_name);
940 goto exit_binary_exception;
942exit_binary_result_object:
943 if (unlikely(obj_result == NULL)) {
944 return NUITKA_BOOL_EXCEPTION;
948 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
949 Py_DECREF(obj_result);
953exit_binary_exception:
954 return NUITKA_BOOL_EXCEPTION;
956static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
957 CHECK_OBJECT(operand1);
958 assert(PyInt_CheckExact(operand1));
959 CHECK_OBJECT(operand2);
961 PyTypeObject *type2 = Py_TYPE(operand2);
963 if (&PyInt_Type == type2) {
971#pragma warning(disable : 4101)
973 NUITKA_MAY_BE_UNUSED
bool cbool_result;
974 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
975 NUITKA_MAY_BE_UNUSED
long clong_result;
976 NUITKA_MAY_BE_UNUSED
double cfloat_result;
981 CHECK_OBJECT(operand1);
982 assert(PyInt_CheckExact(operand1));
983 CHECK_OBJECT(operand2);
984 assert(PyInt_CheckExact(operand2));
986 const long a = PyInt_AS_LONG(operand1);
987 const long b = PyInt_AS_LONG(operand2);
989 const long x = (long)((
unsigned long)a + b);
990 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
991 bool t = !no_overflow || x != 0;
994 goto exit_result_ok_cbool;
996 exit_result_ok_cbool:
997 result = cbool_result ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1004 return __BINARY_OPERATION_ADD_NBOOL_INT_OBJECT(operand1, operand2);
1007nuitka_bool BINARY_OPERATION_ADD_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
1008 return _BINARY_OPERATION_ADD_NBOOL_INT_OBJECT(operand1, operand2);
1013static PyObject *_BINARY_OPERATION_ADD_OBJECT_LONG_LONG(PyObject *operand1, PyObject *operand2) {
1014 CHECK_OBJECT(operand1);
1015 assert(PyLong_CheckExact(operand1));
1016 CHECK_OBJECT(operand2);
1017 assert(PyLong_CheckExact(operand2));
1022#if defined(_MSC_VER)
1023#pragma warning(push)
1024#pragma warning(disable : 4101)
1026 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1027 NUITKA_MAY_BE_UNUSED
long clong_result;
1028#if defined(_MSC_VER)
1032 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
1034 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
1036 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && Nuitka_LongGetDigitSize(operand2_long_object) <= 1) {
1037 long r = (long)(MEDIUM_VALUE(operand1_long_object) + MEDIUM_VALUE(operand2_long_object));
1040 goto exit_result_ok_clong;
1046 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
1047 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
1048 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
1049 digit
const *b_digits = Nuitka_LongGetDigitPointer(operand2_long_object);
1050 Py_ssize_t b_digit_count = Nuitka_LongGetDigitSize(operand2_long_object);
1051 bool b_negative = Nuitka_LongIsNegative(operand2_long_object);
1055 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1056 Nuitka_LongFlipSign(z);
1058 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
1062 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1064 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1068 obj_result = (PyObject *)z;
1069 goto exit_result_object;
1073 if (unlikely(obj_result == NULL)) {
1074 goto exit_result_exception;
1076 result = obj_result;
1077 goto exit_result_ok;
1079exit_result_ok_clong:
1080 result = Nuitka_LongFromCLong(clong_result);
1081 goto exit_result_ok;
1086exit_result_exception:
1090PyObject *BINARY_OPERATION_ADD_OBJECT_LONG_LONG(PyObject *operand1, PyObject *operand2) {
1091 return _BINARY_OPERATION_ADD_OBJECT_LONG_LONG(operand1, operand2);
1095static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
1096 PyTypeObject *type1 = Py_TYPE(operand1);
1098#if defined(_MSC_VER)
1099#pragma warning(push)
1100#pragma warning(disable : 4101)
1102 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1103 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1104#if defined(_MSC_VER)
1109 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
1110 binaryfunc slot2 = NULL;
1112 if (!(type1 == &PyLong_Type)) {
1115 slot2 = PyLong_Type.tp_as_number->nb_add;
1117 if (slot1 == slot2) {
1122 if (slot1 != NULL) {
1123 PyObject *x = slot1(operand1, operand2);
1125 if (x != Py_NotImplemented) {
1127 goto exit_binary_result_object;
1130 Py_DECREF_IMMORTAL(x);
1133 if (slot2 != NULL) {
1134 PyObject *x = slot2(operand1, operand2);
1136 if (x != Py_NotImplemented) {
1138 goto exit_binary_result_object;
1141 Py_DECREF_IMMORTAL(x);
1144#if PYTHON_VERSION < 0x300
1145 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1147 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1150 PyObject *coerced1 = operand1;
1151 PyObject *coerced2 = operand2;
1153 int err = c1(&coerced1, &coerced2);
1155 if (unlikely(err < 0)) {
1156 goto exit_binary_exception;
1160 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1162 if (likely(mv == NULL)) {
1163 binaryfunc slot = mv->nb_add;
1165 if (likely(slot != NULL)) {
1166 PyObject *x = slot(coerced1, coerced2);
1168 Py_DECREF(coerced1);
1169 Py_DECREF(coerced2);
1172 goto exit_binary_result_object;
1177 Py_DECREF(coerced1);
1178 Py_DECREF(coerced2);
1181 coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
1184 PyObject *coerced1 = operand1;
1185 PyObject *coerced2 = operand2;
1187 int err = c2(&coerced2, &coerced1);
1189 if (unlikely(err < 0)) {
1190 goto exit_binary_exception;
1194 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1196 if (likely(mv == NULL)) {
1197 binaryfunc slot = mv->nb_add;
1199 if (likely(slot != NULL)) {
1200 PyObject *x = slot(coerced1, coerced2);
1202 Py_DECREF(coerced1);
1203 Py_DECREF(coerced2);
1206 goto exit_binary_result_object;
1211 Py_DECREF(coerced1);
1212 Py_DECREF(coerced2);
1220 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
1222 if (sq_slot != NULL) {
1223 PyObject *result = sq_slot(operand1, operand2);
1225 obj_result = result;
1226 goto exit_binary_result_object;
1230#if PYTHON_VERSION < 0x300
1231 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'long'", type1->tp_name);
1233 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'int'", type1->tp_name);
1235 goto exit_binary_exception;
1237exit_binary_result_object:
1240exit_binary_exception:
1243static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
1244 CHECK_OBJECT(operand1);
1245 CHECK_OBJECT(operand2);
1246 assert(PyLong_CheckExact(operand2));
1248 PyTypeObject *type1 = Py_TYPE(operand1);
1250 if (type1 == &PyLong_Type) {
1256#if defined(_MSC_VER)
1257#pragma warning(push)
1258#pragma warning(disable : 4101)
1260 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1261 NUITKA_MAY_BE_UNUSED
long clong_result;
1262#if defined(_MSC_VER)
1266 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
1268 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
1270 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && Nuitka_LongGetDigitSize(operand2_long_object) <= 1) {
1271 long r = (long)(MEDIUM_VALUE(operand1_long_object) + MEDIUM_VALUE(operand2_long_object));
1274 goto exit_result_ok_clong;
1280 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
1281 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
1282 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
1283 digit
const *b_digits = Nuitka_LongGetDigitPointer(operand2_long_object);
1284 Py_ssize_t b_digit_count = Nuitka_LongGetDigitSize(operand2_long_object);
1285 bool b_negative = Nuitka_LongIsNegative(operand2_long_object);
1289 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1290 Nuitka_LongFlipSign(z);
1292 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
1296 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1298 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1302 obj_result = (PyObject *)z;
1303 goto exit_result_object;
1307 if (unlikely(obj_result == NULL)) {
1308 goto exit_result_exception;
1310 result = obj_result;
1311 goto exit_result_ok;
1313 exit_result_ok_clong:
1314 result = Nuitka_LongFromCLong(clong_result);
1315 goto exit_result_ok;
1320 exit_result_exception:
1324 return __BINARY_OPERATION_ADD_OBJECT_OBJECT_LONG(operand1, operand2);
1327PyObject *BINARY_OPERATION_ADD_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
1328 return _BINARY_OPERATION_ADD_OBJECT_OBJECT_LONG(operand1, operand2);
1332static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
1333 PyTypeObject *type2 = Py_TYPE(operand2);
1335#if defined(_MSC_VER)
1336#pragma warning(push)
1337#pragma warning(disable : 4101)
1339 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1340 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1341#if defined(_MSC_VER)
1345 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_add;
1346 binaryfunc slot2 = NULL;
1348 if (!(&PyLong_Type == type2)) {
1351 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
1353 if (slot1 == slot2) {
1358 if (slot1 != NULL) {
1359 if (slot2 != NULL) {
1360 if (Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
1361 PyObject *x = slot2(operand1, operand2);
1363 if (x != Py_NotImplemented) {
1365 goto exit_binary_result_object;
1368 Py_DECREF_IMMORTAL(x);
1373 PyObject *x = slot1(operand1, operand2);
1375 if (x != Py_NotImplemented) {
1377 goto exit_binary_result_object;
1380 Py_DECREF_IMMORTAL(x);
1383 if (slot2 != NULL) {
1384 PyObject *x = slot2(operand1, operand2);
1386 if (x != Py_NotImplemented) {
1388 goto exit_binary_result_object;
1391 Py_DECREF_IMMORTAL(x);
1394#if PYTHON_VERSION < 0x300
1395 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1396 coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
1399 PyObject *coerced1 = operand1;
1400 PyObject *coerced2 = operand2;
1402 int err = c1(&coerced1, &coerced2);
1404 if (unlikely(err < 0)) {
1405 goto exit_binary_exception;
1409 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1411 if (likely(mv == NULL)) {
1412 binaryfunc slot = mv->nb_add;
1414 if (likely(slot != NULL)) {
1415 PyObject *x = slot(coerced1, coerced2);
1417 Py_DECREF(coerced1);
1418 Py_DECREF(coerced2);
1421 goto exit_binary_result_object;
1426 Py_DECREF(coerced1);
1427 Py_DECREF(coerced2);
1431 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1434 PyObject *coerced1 = operand1;
1435 PyObject *coerced2 = operand2;
1437 int err = c2(&coerced2, &coerced1);
1439 if (unlikely(err < 0)) {
1440 goto exit_binary_exception;
1444 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1446 if (likely(mv == NULL)) {
1447 binaryfunc slot = mv->nb_add;
1449 if (likely(slot != NULL)) {
1450 PyObject *x = slot(coerced1, coerced2);
1452 Py_DECREF(coerced1);
1453 Py_DECREF(coerced2);
1456 goto exit_binary_result_object;
1461 Py_DECREF(coerced1);
1462 Py_DECREF(coerced2);
1472#if PYTHON_VERSION < 0x300
1473 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'long' and '%s'", type2->tp_name);
1475 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'int' and '%s'", type2->tp_name);
1477 goto exit_binary_exception;
1479exit_binary_result_object:
1482exit_binary_exception:
1485static PyObject *_BINARY_OPERATION_ADD_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
1486 CHECK_OBJECT(operand1);
1487 assert(PyLong_CheckExact(operand1));
1488 CHECK_OBJECT(operand2);
1490 PyTypeObject *type2 = Py_TYPE(operand2);
1492 if (&PyLong_Type == type2) {
1498#if defined(_MSC_VER)
1499#pragma warning(push)
1500#pragma warning(disable : 4101)
1502 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1503 NUITKA_MAY_BE_UNUSED
long clong_result;
1504#if defined(_MSC_VER)
1508 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
1510 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
1512 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && Nuitka_LongGetDigitSize(operand2_long_object) <= 1) {
1513 long r = (long)(MEDIUM_VALUE(operand1_long_object) + MEDIUM_VALUE(operand2_long_object));
1516 goto exit_result_ok_clong;
1522 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
1523 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
1524 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
1525 digit
const *b_digits = Nuitka_LongGetDigitPointer(operand2_long_object);
1526 Py_ssize_t b_digit_count = Nuitka_LongGetDigitSize(operand2_long_object);
1527 bool b_negative = Nuitka_LongIsNegative(operand2_long_object);
1531 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1532 Nuitka_LongFlipSign(z);
1534 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
1538 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1540 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1544 obj_result = (PyObject *)z;
1545 goto exit_result_object;
1549 if (unlikely(obj_result == NULL)) {
1550 goto exit_result_exception;
1552 result = obj_result;
1553 goto exit_result_ok;
1555 exit_result_ok_clong:
1556 result = Nuitka_LongFromCLong(clong_result);
1557 goto exit_result_ok;
1562 exit_result_exception:
1566 return __BINARY_OPERATION_ADD_OBJECT_LONG_OBJECT(operand1, operand2);
1569PyObject *BINARY_OPERATION_ADD_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
1570 return _BINARY_OPERATION_ADD_OBJECT_LONG_OBJECT(operand1, operand2);
1574static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
1575 CHECK_OBJECT(operand1);
1576 assert(PyLong_CheckExact(operand1));
1577 CHECK_OBJECT(operand2);
1578 assert(PyLong_CheckExact(operand2));
1583#if defined(_MSC_VER)
1584#pragma warning(push)
1585#pragma warning(disable : 4101)
1587 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1588 NUITKA_MAY_BE_UNUSED
long clong_result;
1589#if defined(_MSC_VER)
1593 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
1595 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
1597 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && Nuitka_LongGetDigitSize(operand2_long_object) <= 1) {
1598 long r = (long)(MEDIUM_VALUE(operand1_long_object) + MEDIUM_VALUE(operand2_long_object));
1601 goto exit_result_ok_clong;
1607 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
1608 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
1609 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
1610 digit
const *b_digits = Nuitka_LongGetDigitPointer(operand2_long_object);
1611 Py_ssize_t b_digit_count = Nuitka_LongGetDigitSize(operand2_long_object);
1612 bool b_negative = Nuitka_LongIsNegative(operand2_long_object);
1616 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1617 Nuitka_LongFlipSign(z);
1619 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
1623 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1625 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1629 obj_result = (PyObject *)z;
1630 goto exit_result_object;
1634 if (unlikely(obj_result == NULL)) {
1635 goto exit_result_exception;
1637 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1638 Py_DECREF(obj_result);
1639 goto exit_result_ok;
1641exit_result_ok_clong:
1642 result = clong_result != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1643 goto exit_result_ok;
1648exit_result_exception:
1649 return NUITKA_BOOL_EXCEPTION;
1652nuitka_bool BINARY_OPERATION_ADD_NBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
1653 return _BINARY_OPERATION_ADD_NBOOL_LONG_LONG(operand1, operand2);
1657static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_ADD_NBOOL_OBJECT_LONG(PyObject *operand1,
1658 PyObject *operand2) {
1659 PyTypeObject *type1 = Py_TYPE(operand1);
1661#if defined(_MSC_VER)
1662#pragma warning(push)
1663#pragma warning(disable : 4101)
1665 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1666 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1667#if defined(_MSC_VER)
1672 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
1673 binaryfunc slot2 = NULL;
1675 if (!(type1 == &PyLong_Type)) {
1678 slot2 = PyLong_Type.tp_as_number->nb_add;
1680 if (slot1 == slot2) {
1685 if (slot1 != NULL) {
1686 PyObject *x = slot1(operand1, operand2);
1688 if (x != Py_NotImplemented) {
1690 goto exit_binary_result_object;
1693 Py_DECREF_IMMORTAL(x);
1696 if (slot2 != NULL) {
1697 PyObject *x = slot2(operand1, operand2);
1699 if (x != Py_NotImplemented) {
1701 goto exit_binary_result_object;
1704 Py_DECREF_IMMORTAL(x);
1707#if PYTHON_VERSION < 0x300
1708 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1710 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1713 PyObject *coerced1 = operand1;
1714 PyObject *coerced2 = operand2;
1716 int err = c1(&coerced1, &coerced2);
1718 if (unlikely(err < 0)) {
1719 goto exit_binary_exception;
1723 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1725 if (likely(mv == NULL)) {
1726 binaryfunc slot = mv->nb_add;
1728 if (likely(slot != NULL)) {
1729 PyObject *x = slot(coerced1, coerced2);
1731 Py_DECREF(coerced1);
1732 Py_DECREF(coerced2);
1735 goto exit_binary_result_object;
1740 Py_DECREF(coerced1);
1741 Py_DECREF(coerced2);
1744 coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
1747 PyObject *coerced1 = operand1;
1748 PyObject *coerced2 = operand2;
1750 int err = c2(&coerced2, &coerced1);
1752 if (unlikely(err < 0)) {
1753 goto exit_binary_exception;
1757 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1759 if (likely(mv == NULL)) {
1760 binaryfunc slot = mv->nb_add;
1762 if (likely(slot != NULL)) {
1763 PyObject *x = slot(coerced1, coerced2);
1765 Py_DECREF(coerced1);
1766 Py_DECREF(coerced2);
1769 goto exit_binary_result_object;
1774 Py_DECREF(coerced1);
1775 Py_DECREF(coerced2);
1783 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
1785 if (sq_slot != NULL) {
1786 PyObject *result = sq_slot(operand1, operand2);
1788 obj_result = result;
1789 goto exit_binary_result_object;
1793#if PYTHON_VERSION < 0x300
1794 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'long'", type1->tp_name);
1796 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'int'", type1->tp_name);
1798 goto exit_binary_exception;
1800exit_binary_result_object:
1801 if (unlikely(obj_result == NULL)) {
1802 return NUITKA_BOOL_EXCEPTION;
1806 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1807 Py_DECREF(obj_result);
1811exit_binary_exception:
1812 return NUITKA_BOOL_EXCEPTION;
1814static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
1815 CHECK_OBJECT(operand1);
1816 CHECK_OBJECT(operand2);
1817 assert(PyLong_CheckExact(operand2));
1819 PyTypeObject *type1 = Py_TYPE(operand1);
1821 if (type1 == &PyLong_Type) {
1827#if defined(_MSC_VER)
1828#pragma warning(push)
1829#pragma warning(disable : 4101)
1831 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1832 NUITKA_MAY_BE_UNUSED
long clong_result;
1833#if defined(_MSC_VER)
1837 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
1839 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
1841 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && Nuitka_LongGetDigitSize(operand2_long_object) <= 1) {
1842 long r = (long)(MEDIUM_VALUE(operand1_long_object) + MEDIUM_VALUE(operand2_long_object));
1845 goto exit_result_ok_clong;
1851 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
1852 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
1853 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
1854 digit
const *b_digits = Nuitka_LongGetDigitPointer(operand2_long_object);
1855 Py_ssize_t b_digit_count = Nuitka_LongGetDigitSize(operand2_long_object);
1856 bool b_negative = Nuitka_LongIsNegative(operand2_long_object);
1860 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1861 Nuitka_LongFlipSign(z);
1863 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
1867 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1869 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1873 obj_result = (PyObject *)z;
1874 goto exit_result_object;
1878 if (unlikely(obj_result == NULL)) {
1879 goto exit_result_exception;
1881 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1882 Py_DECREF(obj_result);
1883 goto exit_result_ok;
1885 exit_result_ok_clong:
1886 result = clong_result != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1887 goto exit_result_ok;
1892 exit_result_exception:
1893 return NUITKA_BOOL_EXCEPTION;
1896 return __BINARY_OPERATION_ADD_NBOOL_OBJECT_LONG(operand1, operand2);
1899nuitka_bool BINARY_OPERATION_ADD_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
1900 return _BINARY_OPERATION_ADD_NBOOL_OBJECT_LONG(operand1, operand2);
1904static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_ADD_NBOOL_LONG_OBJECT(PyObject *operand1,
1905 PyObject *operand2) {
1906 PyTypeObject *type2 = Py_TYPE(operand2);
1908#if defined(_MSC_VER)
1909#pragma warning(push)
1910#pragma warning(disable : 4101)
1912 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1913 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1914#if defined(_MSC_VER)
1918 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_add;
1919 binaryfunc slot2 = NULL;
1921 if (!(&PyLong_Type == type2)) {
1924 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
1926 if (slot1 == slot2) {
1931 if (slot1 != NULL) {
1932 if (slot2 != NULL) {
1933 if (Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
1934 PyObject *x = slot2(operand1, operand2);
1936 if (x != Py_NotImplemented) {
1938 goto exit_binary_result_object;
1941 Py_DECREF_IMMORTAL(x);
1946 PyObject *x = slot1(operand1, operand2);
1948 if (x != Py_NotImplemented) {
1950 goto exit_binary_result_object;
1953 Py_DECREF_IMMORTAL(x);
1956 if (slot2 != NULL) {
1957 PyObject *x = slot2(operand1, operand2);
1959 if (x != Py_NotImplemented) {
1961 goto exit_binary_result_object;
1964 Py_DECREF_IMMORTAL(x);
1967#if PYTHON_VERSION < 0x300
1968 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1969 coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
1972 PyObject *coerced1 = operand1;
1973 PyObject *coerced2 = operand2;
1975 int err = c1(&coerced1, &coerced2);
1977 if (unlikely(err < 0)) {
1978 goto exit_binary_exception;
1982 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1984 if (likely(mv == NULL)) {
1985 binaryfunc slot = mv->nb_add;
1987 if (likely(slot != NULL)) {
1988 PyObject *x = slot(coerced1, coerced2);
1990 Py_DECREF(coerced1);
1991 Py_DECREF(coerced2);
1994 goto exit_binary_result_object;
1999 Py_DECREF(coerced1);
2000 Py_DECREF(coerced2);
2004 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2007 PyObject *coerced1 = operand1;
2008 PyObject *coerced2 = operand2;
2010 int err = c2(&coerced2, &coerced1);
2012 if (unlikely(err < 0)) {
2013 goto exit_binary_exception;
2017 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2019 if (likely(mv == NULL)) {
2020 binaryfunc slot = mv->nb_add;
2022 if (likely(slot != NULL)) {
2023 PyObject *x = slot(coerced1, coerced2);
2025 Py_DECREF(coerced1);
2026 Py_DECREF(coerced2);
2029 goto exit_binary_result_object;
2034 Py_DECREF(coerced1);
2035 Py_DECREF(coerced2);
2045#if PYTHON_VERSION < 0x300
2046 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'long' and '%s'", type2->tp_name);
2048 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'int' and '%s'", type2->tp_name);
2050 goto exit_binary_exception;
2052exit_binary_result_object:
2053 if (unlikely(obj_result == NULL)) {
2054 return NUITKA_BOOL_EXCEPTION;
2058 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2059 Py_DECREF(obj_result);
2063exit_binary_exception:
2064 return NUITKA_BOOL_EXCEPTION;
2066static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
2067 CHECK_OBJECT(operand1);
2068 assert(PyLong_CheckExact(operand1));
2069 CHECK_OBJECT(operand2);
2071 PyTypeObject *type2 = Py_TYPE(operand2);
2073 if (&PyLong_Type == type2) {
2079#if defined(_MSC_VER)
2080#pragma warning(push)
2081#pragma warning(disable : 4101)
2083 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2084 NUITKA_MAY_BE_UNUSED
long clong_result;
2085#if defined(_MSC_VER)
2089 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
2091 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
2093 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && Nuitka_LongGetDigitSize(operand2_long_object) <= 1) {
2094 long r = (long)(MEDIUM_VALUE(operand1_long_object) + MEDIUM_VALUE(operand2_long_object));
2097 goto exit_result_ok_clong;
2103 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
2104 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
2105 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
2106 digit
const *b_digits = Nuitka_LongGetDigitPointer(operand2_long_object);
2107 Py_ssize_t b_digit_count = Nuitka_LongGetDigitSize(operand2_long_object);
2108 bool b_negative = Nuitka_LongIsNegative(operand2_long_object);
2112 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
2113 Nuitka_LongFlipSign(z);
2115 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
2119 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
2121 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
2125 obj_result = (PyObject *)z;
2126 goto exit_result_object;
2130 if (unlikely(obj_result == NULL)) {
2131 goto exit_result_exception;
2133 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2134 Py_DECREF(obj_result);
2135 goto exit_result_ok;
2137 exit_result_ok_clong:
2138 result = clong_result != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2139 goto exit_result_ok;
2144 exit_result_exception:
2145 return NUITKA_BOOL_EXCEPTION;
2148 return __BINARY_OPERATION_ADD_NBOOL_LONG_OBJECT(operand1, operand2);
2151nuitka_bool BINARY_OPERATION_ADD_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
2152 return _BINARY_OPERATION_ADD_NBOOL_LONG_OBJECT(operand1, operand2);
2156static PyObject *_BINARY_OPERATION_ADD_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
2157 CHECK_OBJECT(operand1);
2158 assert(PyFloat_CheckExact(operand1));
2159 CHECK_OBJECT(operand2);
2160 assert(PyFloat_CheckExact(operand2));
2164#if defined(_MSC_VER)
2165#pragma warning(push)
2166#pragma warning(disable : 4101)
2169 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2170 NUITKA_MAY_BE_UNUSED
long clong_result;
2171 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2172#if defined(_MSC_VER)
2176 CHECK_OBJECT(operand1);
2177 assert(PyFloat_CheckExact(operand1));
2178 CHECK_OBJECT(operand2);
2179 assert(PyFloat_CheckExact(operand2));
2181 const double a = PyFloat_AS_DOUBLE(operand1);
2182 const double b = PyFloat_AS_DOUBLE(operand2);
2187 goto exit_result_ok_cfloat;
2189exit_result_ok_cfloat:
2190 result = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2191 goto exit_result_ok;
2197PyObject *BINARY_OPERATION_ADD_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
2198 return _BINARY_OPERATION_ADD_OBJECT_FLOAT_FLOAT(operand1, operand2);
2202static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_OBJECT_FLOAT(PyObject *operand1,
2203 PyObject *operand2) {
2204 PyTypeObject *type1 = Py_TYPE(operand1);
2206#if defined(_MSC_VER)
2207#pragma warning(push)
2208#pragma warning(disable : 4101)
2210 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2211 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2212#if defined(_MSC_VER)
2217 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
2218 binaryfunc slot2 = NULL;
2220 if (!(type1 == &PyFloat_Type)) {
2223 slot2 = PyFloat_Type.tp_as_number->nb_add;
2225 if (slot1 == slot2) {
2230 if (slot1 != NULL) {
2231 PyObject *x = slot1(operand1, operand2);
2233 if (x != Py_NotImplemented) {
2235 goto exit_binary_result_object;
2238 Py_DECREF_IMMORTAL(x);
2241 if (slot2 != NULL) {
2242 PyObject *x = slot2(operand1, operand2);
2244 if (x != Py_NotImplemented) {
2246 goto exit_binary_result_object;
2249 Py_DECREF_IMMORTAL(x);
2252#if PYTHON_VERSION < 0x300
2253 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
2255 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
2258 PyObject *coerced1 = operand1;
2259 PyObject *coerced2 = operand2;
2261 int err = c1(&coerced1, &coerced2);
2263 if (unlikely(err < 0)) {
2264 goto exit_binary_exception;
2268 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2270 if (likely(mv == NULL)) {
2271 binaryfunc slot = mv->nb_add;
2273 if (likely(slot != NULL)) {
2274 PyObject *x = slot(coerced1, coerced2);
2276 Py_DECREF(coerced1);
2277 Py_DECREF(coerced2);
2280 goto exit_binary_result_object;
2285 Py_DECREF(coerced1);
2286 Py_DECREF(coerced2);
2289 coercion c2 = PyFloat_Type.tp_as_number->nb_coerce;
2292 PyObject *coerced1 = operand1;
2293 PyObject *coerced2 = operand2;
2295 int err = c2(&coerced2, &coerced1);
2297 if (unlikely(err < 0)) {
2298 goto exit_binary_exception;
2302 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2304 if (likely(mv == NULL)) {
2305 binaryfunc slot = mv->nb_add;
2307 if (likely(slot != NULL)) {
2308 PyObject *x = slot(coerced1, coerced2);
2310 Py_DECREF(coerced1);
2311 Py_DECREF(coerced2);
2314 goto exit_binary_result_object;
2319 Py_DECREF(coerced1);
2320 Py_DECREF(coerced2);
2328 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
2330 if (sq_slot != NULL) {
2331 PyObject *result = sq_slot(operand1, operand2);
2333 obj_result = result;
2334 goto exit_binary_result_object;
2338 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'float'", type1->tp_name);
2339 goto exit_binary_exception;
2341exit_binary_result_object:
2344exit_binary_exception:
2347static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
2348 CHECK_OBJECT(operand1);
2349 CHECK_OBJECT(operand2);
2350 assert(PyFloat_CheckExact(operand2));
2352 PyTypeObject *type1 = Py_TYPE(operand1);
2354 if (type1 == &PyFloat_Type) {
2359#if defined(_MSC_VER)
2360#pragma warning(push)
2361#pragma warning(disable : 4101)
2364 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2365 NUITKA_MAY_BE_UNUSED
long clong_result;
2366 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2367#if defined(_MSC_VER)
2371 CHECK_OBJECT(operand1);
2372 assert(PyFloat_CheckExact(operand1));
2373 CHECK_OBJECT(operand2);
2374 assert(PyFloat_CheckExact(operand2));
2376 const double a = PyFloat_AS_DOUBLE(operand1);
2377 const double b = PyFloat_AS_DOUBLE(operand2);
2382 goto exit_result_ok_cfloat;
2384 exit_result_ok_cfloat:
2385 result = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2386 goto exit_result_ok;
2392 return __BINARY_OPERATION_ADD_OBJECT_OBJECT_FLOAT(operand1, operand2);
2395PyObject *BINARY_OPERATION_ADD_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
2396 return _BINARY_OPERATION_ADD_OBJECT_OBJECT_FLOAT(operand1, operand2);
2400static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_FLOAT_OBJECT(PyObject *operand1,
2401 PyObject *operand2) {
2402 PyTypeObject *type2 = Py_TYPE(operand2);
2404#if defined(_MSC_VER)
2405#pragma warning(push)
2406#pragma warning(disable : 4101)
2408 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2409 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2410#if defined(_MSC_VER)
2414 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_add;
2415 binaryfunc slot2 = NULL;
2417 if (!(&PyFloat_Type == type2)) {
2420 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
2422 if (slot1 == slot2) {
2427 if (slot1 != NULL) {
2428 if (slot2 != NULL) {
2429 if (Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
2430 PyObject *x = slot2(operand1, operand2);
2432 if (x != Py_NotImplemented) {
2434 goto exit_binary_result_object;
2437 Py_DECREF_IMMORTAL(x);
2442 PyObject *x = slot1(operand1, operand2);
2444 if (x != Py_NotImplemented) {
2446 goto exit_binary_result_object;
2449 Py_DECREF_IMMORTAL(x);
2452 if (slot2 != NULL) {
2453 PyObject *x = slot2(operand1, operand2);
2455 if (x != Py_NotImplemented) {
2457 goto exit_binary_result_object;
2460 Py_DECREF_IMMORTAL(x);
2463#if PYTHON_VERSION < 0x300
2464 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
2465 coercion c1 = PyFloat_Type.tp_as_number->nb_coerce;
2468 PyObject *coerced1 = operand1;
2469 PyObject *coerced2 = operand2;
2471 int err = c1(&coerced1, &coerced2);
2473 if (unlikely(err < 0)) {
2474 goto exit_binary_exception;
2478 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2480 if (likely(mv == NULL)) {
2481 binaryfunc slot = mv->nb_add;
2483 if (likely(slot != NULL)) {
2484 PyObject *x = slot(coerced1, coerced2);
2486 Py_DECREF(coerced1);
2487 Py_DECREF(coerced2);
2490 goto exit_binary_result_object;
2495 Py_DECREF(coerced1);
2496 Py_DECREF(coerced2);
2500 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2503 PyObject *coerced1 = operand1;
2504 PyObject *coerced2 = operand2;
2506 int err = c2(&coerced2, &coerced1);
2508 if (unlikely(err < 0)) {
2509 goto exit_binary_exception;
2513 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2515 if (likely(mv == NULL)) {
2516 binaryfunc slot = mv->nb_add;
2518 if (likely(slot != NULL)) {
2519 PyObject *x = slot(coerced1, coerced2);
2521 Py_DECREF(coerced1);
2522 Py_DECREF(coerced2);
2525 goto exit_binary_result_object;
2530 Py_DECREF(coerced1);
2531 Py_DECREF(coerced2);
2541 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'float' and '%s'", type2->tp_name);
2542 goto exit_binary_exception;
2544exit_binary_result_object:
2547exit_binary_exception:
2550static PyObject *_BINARY_OPERATION_ADD_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
2551 CHECK_OBJECT(operand1);
2552 assert(PyFloat_CheckExact(operand1));
2553 CHECK_OBJECT(operand2);
2555 PyTypeObject *type2 = Py_TYPE(operand2);
2557 if (&PyFloat_Type == type2) {
2562#if defined(_MSC_VER)
2563#pragma warning(push)
2564#pragma warning(disable : 4101)
2567 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2568 NUITKA_MAY_BE_UNUSED
long clong_result;
2569 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2570#if defined(_MSC_VER)
2574 CHECK_OBJECT(operand1);
2575 assert(PyFloat_CheckExact(operand1));
2576 CHECK_OBJECT(operand2);
2577 assert(PyFloat_CheckExact(operand2));
2579 const double a = PyFloat_AS_DOUBLE(operand1);
2580 const double b = PyFloat_AS_DOUBLE(operand2);
2585 goto exit_result_ok_cfloat;
2587 exit_result_ok_cfloat:
2588 result = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2589 goto exit_result_ok;
2595 return __BINARY_OPERATION_ADD_OBJECT_FLOAT_OBJECT(operand1, operand2);
2598PyObject *BINARY_OPERATION_ADD_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
2599 return _BINARY_OPERATION_ADD_OBJECT_FLOAT_OBJECT(operand1, operand2);
2603static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
2604 CHECK_OBJECT(operand1);
2605 assert(PyFloat_CheckExact(operand1));
2606 CHECK_OBJECT(operand2);
2607 assert(PyFloat_CheckExact(operand2));
2611#if defined(_MSC_VER)
2612#pragma warning(push)
2613#pragma warning(disable : 4101)
2616 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2617 NUITKA_MAY_BE_UNUSED
long clong_result;
2618 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2619#if defined(_MSC_VER)
2623 CHECK_OBJECT(operand1);
2624 assert(PyFloat_CheckExact(operand1));
2625 CHECK_OBJECT(operand2);
2626 assert(PyFloat_CheckExact(operand2));
2628 const double a = PyFloat_AS_DOUBLE(operand1);
2629 const double b = PyFloat_AS_DOUBLE(operand2);
2634 goto exit_result_ok_cfloat;
2636exit_result_ok_cfloat:
2637 result = cfloat_result != 0.0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2638 goto exit_result_ok;
2644nuitka_bool BINARY_OPERATION_ADD_NBOOL_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
2645 return _BINARY_OPERATION_ADD_NBOOL_FLOAT_FLOAT(operand1, operand2);
2649static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_ADD_NBOOL_OBJECT_FLOAT(PyObject *operand1,
2650 PyObject *operand2) {
2651 PyTypeObject *type1 = Py_TYPE(operand1);
2653#if defined(_MSC_VER)
2654#pragma warning(push)
2655#pragma warning(disable : 4101)
2657 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2658 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2659#if defined(_MSC_VER)
2664 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
2665 binaryfunc slot2 = NULL;
2667 if (!(type1 == &PyFloat_Type)) {
2670 slot2 = PyFloat_Type.tp_as_number->nb_add;
2672 if (slot1 == slot2) {
2677 if (slot1 != NULL) {
2678 PyObject *x = slot1(operand1, operand2);
2680 if (x != Py_NotImplemented) {
2682 goto exit_binary_result_object;
2685 Py_DECREF_IMMORTAL(x);
2688 if (slot2 != NULL) {
2689 PyObject *x = slot2(operand1, operand2);
2691 if (x != Py_NotImplemented) {
2693 goto exit_binary_result_object;
2696 Py_DECREF_IMMORTAL(x);
2699#if PYTHON_VERSION < 0x300
2700 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
2702 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
2705 PyObject *coerced1 = operand1;
2706 PyObject *coerced2 = operand2;
2708 int err = c1(&coerced1, &coerced2);
2710 if (unlikely(err < 0)) {
2711 goto exit_binary_exception;
2715 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2717 if (likely(mv == NULL)) {
2718 binaryfunc slot = mv->nb_add;
2720 if (likely(slot != NULL)) {
2721 PyObject *x = slot(coerced1, coerced2);
2723 Py_DECREF(coerced1);
2724 Py_DECREF(coerced2);
2727 goto exit_binary_result_object;
2732 Py_DECREF(coerced1);
2733 Py_DECREF(coerced2);
2736 coercion c2 = PyFloat_Type.tp_as_number->nb_coerce;
2739 PyObject *coerced1 = operand1;
2740 PyObject *coerced2 = operand2;
2742 int err = c2(&coerced2, &coerced1);
2744 if (unlikely(err < 0)) {
2745 goto exit_binary_exception;
2749 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2751 if (likely(mv == NULL)) {
2752 binaryfunc slot = mv->nb_add;
2754 if (likely(slot != NULL)) {
2755 PyObject *x = slot(coerced1, coerced2);
2757 Py_DECREF(coerced1);
2758 Py_DECREF(coerced2);
2761 goto exit_binary_result_object;
2766 Py_DECREF(coerced1);
2767 Py_DECREF(coerced2);
2775 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
2777 if (sq_slot != NULL) {
2778 PyObject *result = sq_slot(operand1, operand2);
2780 obj_result = result;
2781 goto exit_binary_result_object;
2785 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'float'", type1->tp_name);
2786 goto exit_binary_exception;
2788exit_binary_result_object:
2789 if (unlikely(obj_result == NULL)) {
2790 return NUITKA_BOOL_EXCEPTION;
2794 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2795 Py_DECREF(obj_result);
2799exit_binary_exception:
2800 return NUITKA_BOOL_EXCEPTION;
2802static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
2803 CHECK_OBJECT(operand1);
2804 CHECK_OBJECT(operand2);
2805 assert(PyFloat_CheckExact(operand2));
2807 PyTypeObject *type1 = Py_TYPE(operand1);
2809 if (type1 == &PyFloat_Type) {
2814#if defined(_MSC_VER)
2815#pragma warning(push)
2816#pragma warning(disable : 4101)
2819 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2820 NUITKA_MAY_BE_UNUSED
long clong_result;
2821 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2822#if defined(_MSC_VER)
2826 CHECK_OBJECT(operand1);
2827 assert(PyFloat_CheckExact(operand1));
2828 CHECK_OBJECT(operand2);
2829 assert(PyFloat_CheckExact(operand2));
2831 const double a = PyFloat_AS_DOUBLE(operand1);
2832 const double b = PyFloat_AS_DOUBLE(operand2);
2837 goto exit_result_ok_cfloat;
2839 exit_result_ok_cfloat:
2840 result = cfloat_result != 0.0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2841 goto exit_result_ok;
2847 return __BINARY_OPERATION_ADD_NBOOL_OBJECT_FLOAT(operand1, operand2);
2850nuitka_bool BINARY_OPERATION_ADD_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
2851 return _BINARY_OPERATION_ADD_NBOOL_OBJECT_FLOAT(operand1, operand2);
2855static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_ADD_NBOOL_FLOAT_OBJECT(PyObject *operand1,
2856 PyObject *operand2) {
2857 PyTypeObject *type2 = Py_TYPE(operand2);
2859#if defined(_MSC_VER)
2860#pragma warning(push)
2861#pragma warning(disable : 4101)
2863 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2864 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2865#if defined(_MSC_VER)
2869 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_add;
2870 binaryfunc slot2 = NULL;
2872 if (!(&PyFloat_Type == type2)) {
2875 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
2877 if (slot1 == slot2) {
2882 if (slot1 != NULL) {
2883 if (slot2 != NULL) {
2884 if (Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
2885 PyObject *x = slot2(operand1, operand2);
2887 if (x != Py_NotImplemented) {
2889 goto exit_binary_result_object;
2892 Py_DECREF_IMMORTAL(x);
2897 PyObject *x = slot1(operand1, operand2);
2899 if (x != Py_NotImplemented) {
2901 goto exit_binary_result_object;
2904 Py_DECREF_IMMORTAL(x);
2907 if (slot2 != NULL) {
2908 PyObject *x = slot2(operand1, operand2);
2910 if (x != Py_NotImplemented) {
2912 goto exit_binary_result_object;
2915 Py_DECREF_IMMORTAL(x);
2918#if PYTHON_VERSION < 0x300
2919 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
2920 coercion c1 = PyFloat_Type.tp_as_number->nb_coerce;
2923 PyObject *coerced1 = operand1;
2924 PyObject *coerced2 = operand2;
2926 int err = c1(&coerced1, &coerced2);
2928 if (unlikely(err < 0)) {
2929 goto exit_binary_exception;
2933 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2935 if (likely(mv == NULL)) {
2936 binaryfunc slot = mv->nb_add;
2938 if (likely(slot != NULL)) {
2939 PyObject *x = slot(coerced1, coerced2);
2941 Py_DECREF(coerced1);
2942 Py_DECREF(coerced2);
2945 goto exit_binary_result_object;
2950 Py_DECREF(coerced1);
2951 Py_DECREF(coerced2);
2955 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2958 PyObject *coerced1 = operand1;
2959 PyObject *coerced2 = operand2;
2961 int err = c2(&coerced2, &coerced1);
2963 if (unlikely(err < 0)) {
2964 goto exit_binary_exception;
2968 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2970 if (likely(mv == NULL)) {
2971 binaryfunc slot = mv->nb_add;
2973 if (likely(slot != NULL)) {
2974 PyObject *x = slot(coerced1, coerced2);
2976 Py_DECREF(coerced1);
2977 Py_DECREF(coerced2);
2980 goto exit_binary_result_object;
2985 Py_DECREF(coerced1);
2986 Py_DECREF(coerced2);
2996 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'float' and '%s'", type2->tp_name);
2997 goto exit_binary_exception;
2999exit_binary_result_object:
3000 if (unlikely(obj_result == NULL)) {
3001 return NUITKA_BOOL_EXCEPTION;
3005 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3006 Py_DECREF(obj_result);
3010exit_binary_exception:
3011 return NUITKA_BOOL_EXCEPTION;
3013static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
3014 CHECK_OBJECT(operand1);
3015 assert(PyFloat_CheckExact(operand1));
3016 CHECK_OBJECT(operand2);
3018 PyTypeObject *type2 = Py_TYPE(operand2);
3020 if (&PyFloat_Type == type2) {
3025#if defined(_MSC_VER)
3026#pragma warning(push)
3027#pragma warning(disable : 4101)
3030 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3031 NUITKA_MAY_BE_UNUSED
long clong_result;
3032 NUITKA_MAY_BE_UNUSED
double cfloat_result;
3033#if defined(_MSC_VER)
3037 CHECK_OBJECT(operand1);
3038 assert(PyFloat_CheckExact(operand1));
3039 CHECK_OBJECT(operand2);
3040 assert(PyFloat_CheckExact(operand2));
3042 const double a = PyFloat_AS_DOUBLE(operand1);
3043 const double b = PyFloat_AS_DOUBLE(operand2);
3048 goto exit_result_ok_cfloat;
3050 exit_result_ok_cfloat:
3051 result = cfloat_result != 0.0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3052 goto exit_result_ok;
3058 return __BINARY_OPERATION_ADD_NBOOL_FLOAT_OBJECT(operand1, operand2);
3061nuitka_bool BINARY_OPERATION_ADD_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
3062 return _BINARY_OPERATION_ADD_NBOOL_FLOAT_OBJECT(operand1, operand2);
3066static PyObject *_BINARY_OPERATION_ADD_OBJECT_FLOAT_LONG(PyObject *operand1, PyObject *operand2) {
3067 CHECK_OBJECT(operand1);
3068 assert(PyFloat_CheckExact(operand1));
3069 CHECK_OBJECT(operand2);
3070 assert(PyLong_CheckExact(operand2));
3072#if defined(_MSC_VER)
3073#pragma warning(push)
3074#pragma warning(disable : 4101)
3076 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3077 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3078#if defined(_MSC_VER)
3082 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_add;
3085 if (slot1 != NULL) {
3086 PyObject *x = slot1(operand1, operand2);
3088 if (x != Py_NotImplemented) {
3090 goto exit_binary_result_object;
3093 Py_DECREF_IMMORTAL(x);
3102#if PYTHON_VERSION < 0x300
3103 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'float' and 'long'");
3105 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'float' and 'int'");
3107 goto exit_binary_exception;
3109exit_binary_result_object:
3112exit_binary_exception:
3116PyObject *BINARY_OPERATION_ADD_OBJECT_FLOAT_LONG(PyObject *operand1, PyObject *operand2) {
3117 return _BINARY_OPERATION_ADD_OBJECT_FLOAT_LONG(operand1, operand2);
3121static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_FLOAT_LONG(PyObject *operand1, PyObject *operand2) {
3122 CHECK_OBJECT(operand1);
3123 assert(PyFloat_CheckExact(operand1));
3124 CHECK_OBJECT(operand2);
3125 assert(PyLong_CheckExact(operand2));
3127#if defined(_MSC_VER)
3128#pragma warning(push)
3129#pragma warning(disable : 4101)
3131 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3132 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3133#if defined(_MSC_VER)
3137 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_add;
3140 if (slot1 != NULL) {
3141 PyObject *x = slot1(operand1, operand2);
3143 if (x != Py_NotImplemented) {
3145 goto exit_binary_result_object;
3148 Py_DECREF_IMMORTAL(x);
3157#if PYTHON_VERSION < 0x300
3158 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'float' and 'long'");
3160 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'float' and 'int'");
3162 goto exit_binary_exception;
3164exit_binary_result_object:
3165 if (unlikely(obj_result == NULL)) {
3166 return NUITKA_BOOL_EXCEPTION;
3170 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3171 Py_DECREF(obj_result);
3175exit_binary_exception:
3176 return NUITKA_BOOL_EXCEPTION;
3179nuitka_bool BINARY_OPERATION_ADD_NBOOL_FLOAT_LONG(PyObject *operand1, PyObject *operand2) {
3180 return _BINARY_OPERATION_ADD_NBOOL_FLOAT_LONG(operand1, operand2);
3183#if PYTHON_VERSION < 0x300
3185static PyObject *_BINARY_OPERATION_ADD_OBJECT_FLOAT_INT(PyObject *operand1, PyObject *operand2) {
3186 CHECK_OBJECT(operand1);
3187 assert(PyFloat_CheckExact(operand1));
3188 CHECK_OBJECT(operand2);
3189 assert(PyInt_CheckExact(operand2));
3191#if defined(_MSC_VER)
3192#pragma warning(push)
3193#pragma warning(disable : 4101)
3195 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3196 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3197#if defined(_MSC_VER)
3201 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_add;
3204 if (slot1 != NULL) {
3205 PyObject *x = slot1(operand1, operand2);
3207 if (x != Py_NotImplemented) {
3209 goto exit_binary_result_object;
3212 Py_DECREF_IMMORTAL(x);
3221 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'float' and 'int'");
3222 goto exit_binary_exception;
3224exit_binary_result_object:
3227exit_binary_exception:
3231PyObject *BINARY_OPERATION_ADD_OBJECT_FLOAT_INT(PyObject *operand1, PyObject *operand2) {
3232 return _BINARY_OPERATION_ADD_OBJECT_FLOAT_INT(operand1, operand2);
3236#if PYTHON_VERSION < 0x300
3238static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_FLOAT_INT(PyObject *operand1, PyObject *operand2) {
3239 CHECK_OBJECT(operand1);
3240 assert(PyFloat_CheckExact(operand1));
3241 CHECK_OBJECT(operand2);
3242 assert(PyInt_CheckExact(operand2));
3244#if defined(_MSC_VER)
3245#pragma warning(push)
3246#pragma warning(disable : 4101)
3248 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3249 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3250#if defined(_MSC_VER)
3254 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_add;
3257 if (slot1 != NULL) {
3258 PyObject *x = slot1(operand1, operand2);
3260 if (x != Py_NotImplemented) {
3262 goto exit_binary_result_object;
3265 Py_DECREF_IMMORTAL(x);
3274 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'float' and 'int'");
3275 goto exit_binary_exception;
3277exit_binary_result_object:
3278 if (unlikely(obj_result == NULL)) {
3279 return NUITKA_BOOL_EXCEPTION;
3283 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3284 Py_DECREF(obj_result);
3288exit_binary_exception:
3289 return NUITKA_BOOL_EXCEPTION;
3292nuitka_bool BINARY_OPERATION_ADD_NBOOL_FLOAT_INT(PyObject *operand1, PyObject *operand2) {
3293 return _BINARY_OPERATION_ADD_NBOOL_FLOAT_INT(operand1, operand2);
3297#if PYTHON_VERSION < 0x300
3299static PyObject *_BINARY_OPERATION_ADD_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
3300 CHECK_OBJECT(operand1);
3301 assert(PyLong_CheckExact(operand1));
3302 CHECK_OBJECT(operand2);
3303 assert(PyInt_CheckExact(operand2));
3305#if defined(_MSC_VER)
3306#pragma warning(push)
3307#pragma warning(disable : 4101)
3309 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3310 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3311#if defined(_MSC_VER)
3315 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_add;
3318 if (slot1 != NULL) {
3319 PyObject *x = slot1(operand1, operand2);
3321 if (x != Py_NotImplemented) {
3323 goto exit_binary_result_object;
3326 Py_DECREF_IMMORTAL(x);
3335 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'long' and 'int'");
3336 goto exit_binary_exception;
3338exit_binary_result_object:
3341exit_binary_exception:
3345PyObject *BINARY_OPERATION_ADD_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
3346 return _BINARY_OPERATION_ADD_OBJECT_LONG_INT(operand1, operand2);
3350#if PYTHON_VERSION < 0x300
3352static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
3353 CHECK_OBJECT(operand1);
3354 assert(PyLong_CheckExact(operand1));
3355 CHECK_OBJECT(operand2);
3356 assert(PyInt_CheckExact(operand2));
3358#if defined(_MSC_VER)
3359#pragma warning(push)
3360#pragma warning(disable : 4101)
3362 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3363 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3364#if defined(_MSC_VER)
3368 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_add;
3371 if (slot1 != NULL) {
3372 PyObject *x = slot1(operand1, operand2);
3374 if (x != Py_NotImplemented) {
3376 goto exit_binary_result_object;
3379 Py_DECREF_IMMORTAL(x);
3388 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: 'long' and 'int'");
3389 goto exit_binary_exception;
3391exit_binary_result_object:
3392 if (unlikely(obj_result == NULL)) {
3393 return NUITKA_BOOL_EXCEPTION;
3397 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3398 Py_DECREF(obj_result);
3402exit_binary_exception:
3403 return NUITKA_BOOL_EXCEPTION;
3406nuitka_bool BINARY_OPERATION_ADD_NBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
3407 return _BINARY_OPERATION_ADD_NBOOL_LONG_INT(operand1, operand2);
3411#if PYTHON_VERSION < 0x300
3413static PyObject *_BINARY_OPERATION_ADD_OBJECT_INT_CLONG(PyObject *operand1,
long operand2) {
3414 CHECK_OBJECT(operand1);
3415 assert(PyInt_CheckExact(operand1));
3420#if defined(_MSC_VER)
3421#pragma warning(push)
3422#pragma warning(disable : 4101)
3424 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3425 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3426 NUITKA_MAY_BE_UNUSED
long clong_result;
3427 NUITKA_MAY_BE_UNUSED
double cfloat_result;
3428#if defined(_MSC_VER)
3432 CHECK_OBJECT(operand1);
3433 assert(PyInt_CheckExact(operand1));
3435 const long a = PyInt_AS_LONG(operand1);
3436 const long b = operand2;
3438 const long x = (long)((
unsigned long)a + b);
3439 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
3440 if (likely(no_overflow)) {
3442 goto exit_result_ok_clong;
3446 PyObject *operand1_object = operand1;
3447 PyObject *operand2_object = Nuitka_PyLong_FromLong(operand2);
3449 PyObject *r = PyLong_Type.tp_as_number->nb_add(operand1_object, operand2_object);
3450 assert(r != Py_NotImplemented);
3452 Py_DECREF(operand2_object);
3455 goto exit_result_object;
3458exit_result_ok_clong:
3459 result = Nuitka_PyInt_FromLong(clong_result);
3460 goto exit_result_ok;
3463 if (unlikely(obj_result == NULL)) {
3464 goto exit_result_exception;
3466 result = obj_result;
3467 goto exit_result_ok;
3472exit_result_exception:
3476PyObject *BINARY_OPERATION_ADD_OBJECT_INT_CLONG(PyObject *operand1,
long operand2) {
3477 return _BINARY_OPERATION_ADD_OBJECT_INT_CLONG(operand1, operand2);
3481#if PYTHON_VERSION < 0x300
3483static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_INT_CLONG(PyObject *operand1,
long operand2) {
3484 CHECK_OBJECT(operand1);
3485 assert(PyInt_CheckExact(operand1));
3490#if defined(_MSC_VER)
3491#pragma warning(push)
3492#pragma warning(disable : 4101)
3494 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3495 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3496 NUITKA_MAY_BE_UNUSED
long clong_result;
3497 NUITKA_MAY_BE_UNUSED
double cfloat_result;
3498#if defined(_MSC_VER)
3502 CHECK_OBJECT(operand1);
3503 assert(PyInt_CheckExact(operand1));
3505 const long a = PyInt_AS_LONG(operand1);
3506 const long b = operand2;
3508 const long x = (long)((
unsigned long)a + b);
3509 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
3510 bool t = !no_overflow || x != 0;
3513 goto exit_result_ok_cbool;
3515exit_result_ok_cbool:
3516 result = cbool_result ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3517 goto exit_result_ok;
3523nuitka_bool BINARY_OPERATION_ADD_NBOOL_INT_CLONG(PyObject *operand1,
long operand2) {
3524 return _BINARY_OPERATION_ADD_NBOOL_INT_CLONG(operand1, operand2);
3530static PyObject *_BINARY_OPERATION_ADD_OBJECT_LONG_DIGIT(PyObject *operand1,
long operand2) {
3531 CHECK_OBJECT(operand1);
3532 assert(PyLong_CheckExact(operand1));
3533 assert(Py_ABS(operand2) < (1 << PyLong_SHIFT));
3538#if defined(_MSC_VER)
3539#pragma warning(push)
3540#pragma warning(disable : 4101)
3542 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3543 NUITKA_MAY_BE_UNUSED
long clong_result;
3544#if defined(_MSC_VER)
3548 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
3550 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && (operand2 == 0 ? 0 : 1) <= 1) {
3551 long r = (long)(MEDIUM_VALUE(operand1_long_object) + (sdigit)operand2);
3554 goto exit_result_ok_clong;
3560 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
3561 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
3562 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
3563 digit
const *b_digits = (digit *)&operand2;
3564 Py_ssize_t b_digit_count = (operand2 == 0 ? 0 : 1);
3565 bool b_negative = operand2 < 0;
3569 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3570 Nuitka_LongFlipSign(z);
3572 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
3576 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3578 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3582 obj_result = (PyObject *)z;
3583 goto exit_result_object;
3587 if (unlikely(obj_result == NULL)) {
3588 goto exit_result_exception;
3590 result = obj_result;
3591 goto exit_result_ok;
3593exit_result_ok_clong:
3594 result = Nuitka_LongFromCLong(clong_result);
3595 goto exit_result_ok;
3600exit_result_exception:
3604PyObject *BINARY_OPERATION_ADD_OBJECT_LONG_DIGIT(PyObject *operand1,
long operand2) {
3605 return _BINARY_OPERATION_ADD_OBJECT_LONG_DIGIT(operand1, operand2);
3610static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_LONG_DIGIT(PyObject *operand1,
long operand2) {
3611 CHECK_OBJECT(operand1);
3612 assert(PyLong_CheckExact(operand1));
3613 assert(Py_ABS(operand2) < (1 << PyLong_SHIFT));
3618#if defined(_MSC_VER)
3619#pragma warning(push)
3620#pragma warning(disable : 4101)
3622 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3623 NUITKA_MAY_BE_UNUSED
long clong_result;
3624#if defined(_MSC_VER)
3628 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
3630 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && (operand2 == 0 ? 0 : 1) <= 1) {
3631 long r = (long)(MEDIUM_VALUE(operand1_long_object) + (sdigit)operand2);
3634 goto exit_result_ok_clong;
3640 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
3641 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
3642 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
3643 digit
const *b_digits = (digit *)&operand2;
3644 Py_ssize_t b_digit_count = (operand2 == 0 ? 0 : 1);
3645 bool b_negative = operand2 < 0;
3649 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3650 Nuitka_LongFlipSign(z);
3652 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
3656 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3658 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3662 obj_result = (PyObject *)z;
3663 goto exit_result_object;
3667 if (unlikely(obj_result == NULL)) {
3668 goto exit_result_exception;
3670 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3671 Py_DECREF(obj_result);
3672 goto exit_result_ok;
3674exit_result_ok_clong:
3675 result = clong_result != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3676 goto exit_result_ok;
3681exit_result_exception:
3682 return NUITKA_BOOL_EXCEPTION;
3685nuitka_bool BINARY_OPERATION_ADD_NBOOL_LONG_DIGIT(PyObject *operand1,
long operand2) {
3686 return _BINARY_OPERATION_ADD_NBOOL_LONG_DIGIT(operand1, operand2);
3690static PyObject *_BINARY_OPERATION_ADD_OBJECT_LONG_CLONG(PyObject *operand1,
long operand2) {
3691 CHECK_OBJECT(operand1);
3692 assert(PyLong_CheckExact(operand1));
3697#if defined(_MSC_VER)
3698#pragma warning(push)
3699#pragma warning(disable : 4101)
3701 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3702 NUITKA_MAY_BE_UNUSED
long clong_result;
3703#if defined(_MSC_VER)
3707 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
3709 bool operand2_is_negative;
3710 unsigned long operand2_abs_ival;
3713 operand2_abs_ival = (
unsigned long)(-1 - operand2) + 1;
3714 operand2_is_negative =
true;
3716 operand2_abs_ival = (
unsigned long)operand2;
3717 operand2_is_negative =
false;
3720 Py_ssize_t operand2_digit_count = 0;
3721 digit operand2_digits[5] = {0};
3723 unsigned long t = operand2_abs_ival;
3726 operand2_digit_count += 1;
3727 assert(operand2_digit_count <= (Py_ssize_t)(
sizeof(operand2_digit_count) /
sizeof(digit)));
3729 operand2_digits[operand2_digit_count] = (digit)(t & PyLong_MASK);
3734 NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
3735 operand2_is_negative ==
false ? operand2_digit_count : -operand2_digit_count;
3737 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && operand2_digit_count <= 1) {
3738 long r = (long)(MEDIUM_VALUE(operand1_long_object) + (sdigit)operand2);
3741 goto exit_result_ok_clong;
3747 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
3748 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
3749 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
3750 digit
const *b_digits = operand2_digits;
3751 Py_ssize_t b_digit_count = operand2_digit_count;
3752 bool b_negative = operand2_is_negative;
3756 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3757 Nuitka_LongFlipSign(z);
3759 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
3763 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3765 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3769 obj_result = (PyObject *)z;
3770 goto exit_result_object;
3774 if (unlikely(obj_result == NULL)) {
3775 goto exit_result_exception;
3777 result = obj_result;
3778 goto exit_result_ok;
3780exit_result_ok_clong:
3781 result = Nuitka_LongFromCLong(clong_result);
3782 goto exit_result_ok;
3787exit_result_exception:
3791PyObject *BINARY_OPERATION_ADD_OBJECT_LONG_CLONG(PyObject *operand1,
long operand2) {
3792 return _BINARY_OPERATION_ADD_OBJECT_LONG_CLONG(operand1, operand2);
3796static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_LONG_CLONG(PyObject *operand1,
long operand2) {
3797 CHECK_OBJECT(operand1);
3798 assert(PyLong_CheckExact(operand1));
3803#if defined(_MSC_VER)
3804#pragma warning(push)
3805#pragma warning(disable : 4101)
3807 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3808 NUITKA_MAY_BE_UNUSED
long clong_result;
3809#if defined(_MSC_VER)
3813 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
3815 bool operand2_is_negative;
3816 unsigned long operand2_abs_ival;
3819 operand2_abs_ival = (
unsigned long)(-1 - operand2) + 1;
3820 operand2_is_negative =
true;
3822 operand2_abs_ival = (
unsigned long)operand2;
3823 operand2_is_negative =
false;
3826 Py_ssize_t operand2_digit_count = 0;
3827 digit operand2_digits[5] = {0};
3829 unsigned long t = operand2_abs_ival;
3832 operand2_digit_count += 1;
3833 assert(operand2_digit_count <= (Py_ssize_t)(
sizeof(operand2_digit_count) /
sizeof(digit)));
3835 operand2_digits[operand2_digit_count] = (digit)(t & PyLong_MASK);
3840 NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
3841 operand2_is_negative ==
false ? operand2_digit_count : -operand2_digit_count;
3843 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && operand2_digit_count <= 1) {
3844 long r = (long)(MEDIUM_VALUE(operand1_long_object) + (sdigit)operand2);
3847 goto exit_result_ok_clong;
3853 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
3854 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
3855 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
3856 digit
const *b_digits = operand2_digits;
3857 Py_ssize_t b_digit_count = operand2_digit_count;
3858 bool b_negative = operand2_is_negative;
3862 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3863 Nuitka_LongFlipSign(z);
3865 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
3869 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3871 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
3875 obj_result = (PyObject *)z;
3876 goto exit_result_object;
3880 if (unlikely(obj_result == NULL)) {
3881 goto exit_result_exception;
3883 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3884 Py_DECREF(obj_result);
3885 goto exit_result_ok;
3887exit_result_ok_clong:
3888 result = clong_result != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3889 goto exit_result_ok;
3894exit_result_exception:
3895 return NUITKA_BOOL_EXCEPTION;
3898nuitka_bool BINARY_OPERATION_ADD_NBOOL_LONG_CLONG(PyObject *operand1,
long operand2) {
3899 return _BINARY_OPERATION_ADD_NBOOL_LONG_CLONG(operand1, operand2);
3903static PyObject *_BINARY_OPERATION_ADD_OBJECT_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
3904 CHECK_OBJECT(operand1);
3905 assert(PyFloat_CheckExact(operand1));
3909#if defined(_MSC_VER)
3910#pragma warning(push)
3911#pragma warning(disable : 4101)
3914 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3915 NUITKA_MAY_BE_UNUSED
long clong_result;
3916 NUITKA_MAY_BE_UNUSED
double cfloat_result;
3917#if defined(_MSC_VER)
3921 CHECK_OBJECT(operand1);
3922 assert(PyFloat_CheckExact(operand1));
3924 const double a = PyFloat_AS_DOUBLE(operand1);
3925 const double b = operand2;
3930 goto exit_result_ok_cfloat;
3932exit_result_ok_cfloat:
3933 result = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
3934 goto exit_result_ok;
3940PyObject *BINARY_OPERATION_ADD_OBJECT_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
3941 return _BINARY_OPERATION_ADD_OBJECT_FLOAT_CFLOAT(operand1, operand2);
3945static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
3946 CHECK_OBJECT(operand1);
3947 assert(PyFloat_CheckExact(operand1));
3951#if defined(_MSC_VER)
3952#pragma warning(push)
3953#pragma warning(disable : 4101)
3956 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3957 NUITKA_MAY_BE_UNUSED
long clong_result;
3958 NUITKA_MAY_BE_UNUSED
double cfloat_result;
3959#if defined(_MSC_VER)
3963 CHECK_OBJECT(operand1);
3964 assert(PyFloat_CheckExact(operand1));
3966 const double a = PyFloat_AS_DOUBLE(operand1);
3967 const double b = operand2;
3972 goto exit_result_ok_cfloat;
3974exit_result_ok_cfloat:
3975 result = cfloat_result != 0.0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3976 goto exit_result_ok;
3982nuitka_bool BINARY_OPERATION_ADD_NBOOL_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
3983 return _BINARY_OPERATION_ADD_NBOOL_FLOAT_CFLOAT(operand1, operand2);
3986#if PYTHON_VERSION < 0x300
3988static PyObject *_BINARY_OPERATION_ADD_OBJECT_STR_STR(PyObject *operand1, PyObject *operand2) {
3989 CHECK_OBJECT(operand1);
3990 assert(PyString_CheckExact(operand1));
3991 CHECK_OBJECT(operand2);
3992 assert(PyString_CheckExact(operand2));
3997 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3999 PyObject *x = PyString_Type.tp_as_sequence->sq_concat(operand1, operand2);
4000 assert(x != Py_NotImplemented);
4003 goto exit_result_object;
4006 if (unlikely(obj_result == NULL)) {
4007 goto exit_result_exception;
4009 result = obj_result;
4010 goto exit_result_ok;
4015exit_result_exception:
4019PyObject *BINARY_OPERATION_ADD_OBJECT_STR_STR(PyObject *operand1, PyObject *operand2) {
4020 return _BINARY_OPERATION_ADD_OBJECT_STR_STR(operand1, operand2);
4024#if PYTHON_VERSION < 0x300
4026static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
4027 PyTypeObject *type1 = Py_TYPE(operand1);
4029#if defined(_MSC_VER)
4030#pragma warning(push)
4031#pragma warning(disable : 4101)
4033 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4034 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4035#if defined(_MSC_VER)
4040 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
4042 if (slot1 != NULL) {
4043 PyObject *x = slot1(operand1, operand2);
4045 if (x != Py_NotImplemented) {
4047 goto exit_binary_result_object;
4050 Py_DECREF_IMMORTAL(x);
4053#if PYTHON_VERSION < 0x300
4054 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
4056 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
4059 PyObject *coerced1 = operand1;
4060 PyObject *coerced2 = operand2;
4062 int err = c1(&coerced1, &coerced2);
4064 if (unlikely(err < 0)) {
4065 goto exit_binary_exception;
4069 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4071 if (likely(mv == NULL)) {
4072 binaryfunc slot = mv->nb_add;
4074 if (likely(slot != NULL)) {
4075 PyObject *x = slot(coerced1, coerced2);
4077 Py_DECREF(coerced1);
4078 Py_DECREF(coerced2);
4081 goto exit_binary_result_object;
4086 Py_DECREF(coerced1);
4087 Py_DECREF(coerced2);
4095 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
4097 if (sq_slot != NULL) {
4098 PyObject *result = sq_slot(operand1, operand2);
4100 obj_result = result;
4101 goto exit_binary_result_object;
4105 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'str'", type1->tp_name);
4106 goto exit_binary_exception;
4108exit_binary_result_object:
4111exit_binary_exception:
4114static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
4115 CHECK_OBJECT(operand1);
4116 CHECK_OBJECT(operand2);
4117 assert(PyString_CheckExact(operand2));
4119 PyTypeObject *type1 = Py_TYPE(operand1);
4121 if (type1 == &PyString_Type) {
4127 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4129 PyObject *x = PyString_Type.tp_as_sequence->sq_concat(operand1, operand2);
4130 assert(x != Py_NotImplemented);
4133 goto exit_result_object;
4136 if (unlikely(obj_result == NULL)) {
4137 goto exit_result_exception;
4139 result = obj_result;
4140 goto exit_result_ok;
4145 exit_result_exception:
4149 return __BINARY_OPERATION_ADD_OBJECT_OBJECT_STR(operand1, operand2);
4152PyObject *BINARY_OPERATION_ADD_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
4153 return _BINARY_OPERATION_ADD_OBJECT_OBJECT_STR(operand1, operand2);
4157#if PYTHON_VERSION < 0x300
4159static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operand2) {
4160 PyTypeObject *type2 = Py_TYPE(operand2);
4162#if defined(_MSC_VER)
4163#pragma warning(push)
4164#pragma warning(disable : 4101)
4166 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4167 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4168#if defined(_MSC_VER)
4172 binaryfunc slot2 = NULL;
4174 if (!(&PyString_Type == type2)) {
4177 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
4180 if (slot2 != NULL) {
4181 PyObject *x = slot2(operand1, operand2);
4183 if (x != Py_NotImplemented) {
4185 goto exit_binary_result_object;
4188 Py_DECREF_IMMORTAL(x);
4191#if PYTHON_VERSION < 0x300
4192 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
4194 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4197 PyObject *coerced1 = operand1;
4198 PyObject *coerced2 = operand2;
4200 int err = c2(&coerced2, &coerced1);
4202 if (unlikely(err < 0)) {
4203 goto exit_binary_exception;
4207 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4209 if (likely(mv == NULL)) {
4210 binaryfunc slot = mv->nb_add;
4212 if (likely(slot != NULL)) {
4213 PyObject *x = slot(coerced1, coerced2);
4215 Py_DECREF(coerced1);
4216 Py_DECREF(coerced2);
4219 goto exit_binary_result_object;
4224 Py_DECREF(coerced1);
4225 Py_DECREF(coerced2);
4232 PyObject *o = PyString_Type.tp_as_sequence->sq_concat(operand1, operand2);
4234 goto exit_binary_result_object;
4237 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
4239exit_binary_result_object:
4242#if PYTHON_VERSION < 0x300
4243exit_binary_exception:
4247static PyObject *_BINARY_OPERATION_ADD_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operand2) {
4248 CHECK_OBJECT(operand1);
4249 assert(PyString_CheckExact(operand1));
4250 CHECK_OBJECT(operand2);
4252 PyTypeObject *type2 = Py_TYPE(operand2);
4254 if (&PyString_Type == type2) {
4260 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4262 PyObject *x = PyString_Type.tp_as_sequence->sq_concat(operand1, operand2);
4263 assert(x != Py_NotImplemented);
4266 goto exit_result_object;
4269 if (unlikely(obj_result == NULL)) {
4270 goto exit_result_exception;
4272 result = obj_result;
4273 goto exit_result_ok;
4278 exit_result_exception:
4282 return __BINARY_OPERATION_ADD_OBJECT_STR_OBJECT(operand1, operand2);
4285PyObject *BINARY_OPERATION_ADD_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operand2) {
4286 return _BINARY_OPERATION_ADD_OBJECT_STR_OBJECT(operand1, operand2);
4292static PyObject *_BINARY_OPERATION_ADD_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject *operand2) {
4293 CHECK_OBJECT(operand1);
4294 assert(PyUnicode_CheckExact(operand1));
4295 CHECK_OBJECT(operand2);
4296 assert(PyUnicode_CheckExact(operand2));
4301 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4304 PyThreadState *tstate = PyThreadState_GET();
4306 PyObject *x = UNICODE_CONCAT(tstate, operand1, operand2);
4309 goto exit_result_object;
4312 if (unlikely(obj_result == NULL)) {
4313 goto exit_result_exception;
4315 result = obj_result;
4316 goto exit_result_ok;
4321exit_result_exception:
4325PyObject *BINARY_OPERATION_ADD_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject *operand2) {
4326 return _BINARY_OPERATION_ADD_OBJECT_UNICODE_UNICODE(operand1, operand2);
4330static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_OBJECT_UNICODE(PyObject *operand1,
4331 PyObject *operand2) {
4332 PyTypeObject *type1 = Py_TYPE(operand1);
4334#if defined(_MSC_VER)
4335#pragma warning(push)
4336#pragma warning(disable : 4101)
4338 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4339 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4340#if defined(_MSC_VER)
4345 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
4347 if (slot1 != NULL) {
4348 PyObject *x = slot1(operand1, operand2);
4350 if (x != Py_NotImplemented) {
4352 goto exit_binary_result_object;
4355 Py_DECREF_IMMORTAL(x);
4358#if PYTHON_VERSION < 0x300
4359 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
4361 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
4364 PyObject *coerced1 = operand1;
4365 PyObject *coerced2 = operand2;
4367 int err = c1(&coerced1, &coerced2);
4369 if (unlikely(err < 0)) {
4370 goto exit_binary_exception;
4374 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4376 if (likely(mv == NULL)) {
4377 binaryfunc slot = mv->nb_add;
4379 if (likely(slot != NULL)) {
4380 PyObject *x = slot(coerced1, coerced2);
4382 Py_DECREF(coerced1);
4383 Py_DECREF(coerced2);
4386 goto exit_binary_result_object;
4391 Py_DECREF(coerced1);
4392 Py_DECREF(coerced2);
4400 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
4402 if (sq_slot != NULL) {
4403 PyObject *result = sq_slot(operand1, operand2);
4405 obj_result = result;
4406 goto exit_binary_result_object;
4410#if PYTHON_VERSION < 0x300
4411 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'unicode'", type1->tp_name);
4413 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'str'", type1->tp_name);
4415 goto exit_binary_exception;
4417exit_binary_result_object:
4420exit_binary_exception:
4423static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *operand2) {
4424 CHECK_OBJECT(operand1);
4425 CHECK_OBJECT(operand2);
4426 assert(PyUnicode_CheckExact(operand2));
4428 PyTypeObject *type1 = Py_TYPE(operand1);
4430 if (type1 == &PyUnicode_Type) {
4436 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4439 PyThreadState *tstate = PyThreadState_GET();
4441 PyObject *x = UNICODE_CONCAT(tstate, operand1, operand2);
4444 goto exit_result_object;
4447 if (unlikely(obj_result == NULL)) {
4448 goto exit_result_exception;
4450 result = obj_result;
4451 goto exit_result_ok;
4456 exit_result_exception:
4460 return __BINARY_OPERATION_ADD_OBJECT_OBJECT_UNICODE(operand1, operand2);
4463PyObject *BINARY_OPERATION_ADD_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *operand2) {
4464 return _BINARY_OPERATION_ADD_OBJECT_OBJECT_UNICODE(operand1, operand2);
4468static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_UNICODE_OBJECT(PyObject *operand1,
4469 PyObject *operand2) {
4470 PyTypeObject *type2 = Py_TYPE(operand2);
4472#if defined(_MSC_VER)
4473#pragma warning(push)
4474#pragma warning(disable : 4101)
4476 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4477 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4478#if defined(_MSC_VER)
4482 binaryfunc slot2 = NULL;
4484 if (!(&PyUnicode_Type == type2)) {
4487 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
4490 if (slot2 != NULL) {
4491 PyObject *x = slot2(operand1, operand2);
4493 if (x != Py_NotImplemented) {
4495 goto exit_binary_result_object;
4498 Py_DECREF_IMMORTAL(x);
4501#if PYTHON_VERSION < 0x300
4502 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
4504 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4507 PyObject *coerced1 = operand1;
4508 PyObject *coerced2 = operand2;
4510 int err = c2(&coerced2, &coerced1);
4512 if (unlikely(err < 0)) {
4513 goto exit_binary_exception;
4517 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4519 if (likely(mv == NULL)) {
4520 binaryfunc slot = mv->nb_add;
4522 if (likely(slot != NULL)) {
4523 PyObject *x = slot(coerced1, coerced2);
4525 Py_DECREF(coerced1);
4526 Py_DECREF(coerced2);
4529 goto exit_binary_result_object;
4534 Py_DECREF(coerced1);
4535 Py_DECREF(coerced2);
4542 PyObject *o = PyUnicode_Type.tp_as_sequence->sq_concat(operand1, operand2);
4544 goto exit_binary_result_object;
4547 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
4549exit_binary_result_object:
4552#if PYTHON_VERSION < 0x300
4553exit_binary_exception:
4557static PyObject *_BINARY_OPERATION_ADD_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *operand2) {
4558 CHECK_OBJECT(operand1);
4559 assert(PyUnicode_CheckExact(operand1));
4560 CHECK_OBJECT(operand2);
4562 PyTypeObject *type2 = Py_TYPE(operand2);
4564 if (&PyUnicode_Type == type2) {
4570 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4573 PyThreadState *tstate = PyThreadState_GET();
4575 PyObject *x = UNICODE_CONCAT(tstate, operand1, operand2);
4578 goto exit_result_object;
4581 if (unlikely(obj_result == NULL)) {
4582 goto exit_result_exception;
4584 result = obj_result;
4585 goto exit_result_ok;
4590 exit_result_exception:
4594 return __BINARY_OPERATION_ADD_OBJECT_UNICODE_OBJECT(operand1, operand2);
4597PyObject *BINARY_OPERATION_ADD_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *operand2) {
4598 return _BINARY_OPERATION_ADD_OBJECT_UNICODE_OBJECT(operand1, operand2);
4601#if PYTHON_VERSION >= 0x300
4603static PyObject *_BINARY_OPERATION_ADD_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *operand2) {
4604 CHECK_OBJECT(operand1);
4605 assert(PyBytes_CheckExact(operand1));
4606 CHECK_OBJECT(operand2);
4607 assert(PyBytes_CheckExact(operand2));
4612 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4614 PyObject *x = PyBytes_Type.tp_as_sequence->sq_concat(operand1, operand2);
4615 assert(x != Py_NotImplemented);
4618 goto exit_result_object;
4621 if (unlikely(obj_result == NULL)) {
4622 goto exit_result_exception;
4624 result = obj_result;
4625 goto exit_result_ok;
4630exit_result_exception:
4634PyObject *BINARY_OPERATION_ADD_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *operand2) {
4635 return _BINARY_OPERATION_ADD_OBJECT_BYTES_BYTES(operand1, operand2);
4639#if PYTHON_VERSION >= 0x300
4641static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_OBJECT_BYTES(PyObject *operand1,
4642 PyObject *operand2) {
4643 PyTypeObject *type1 = Py_TYPE(operand1);
4645#if defined(_MSC_VER)
4646#pragma warning(push)
4647#pragma warning(disable : 4101)
4649 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4650 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4651#if defined(_MSC_VER)
4656 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
4658 if (slot1 != NULL) {
4659 PyObject *x = slot1(operand1, operand2);
4661 if (x != Py_NotImplemented) {
4663 goto exit_binary_result_object;
4666 Py_DECREF_IMMORTAL(x);
4669#if PYTHON_VERSION < 0x300
4670 if (!NEW_STYLE_NUMBER_TYPE(type1) || !0) {
4672 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
4675 PyObject *coerced1 = operand1;
4676 PyObject *coerced2 = operand2;
4678 int err = c1(&coerced1, &coerced2);
4680 if (unlikely(err < 0)) {
4681 goto exit_binary_exception;
4685 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4687 if (likely(mv == NULL)) {
4688 binaryfunc slot = mv->nb_add;
4690 if (likely(slot != NULL)) {
4691 PyObject *x = slot(coerced1, coerced2);
4693 Py_DECREF(coerced1);
4694 Py_DECREF(coerced2);
4697 goto exit_binary_result_object;
4702 Py_DECREF(coerced1);
4703 Py_DECREF(coerced2);
4711 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
4713 if (sq_slot != NULL) {
4714 PyObject *result = sq_slot(operand1, operand2);
4716 obj_result = result;
4717 goto exit_binary_result_object;
4721 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'bytes'", type1->tp_name);
4722 goto exit_binary_exception;
4724exit_binary_result_object:
4727exit_binary_exception:
4730static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
4731 CHECK_OBJECT(operand1);
4732 CHECK_OBJECT(operand2);
4733 assert(PyBytes_CheckExact(operand2));
4735 PyTypeObject *type1 = Py_TYPE(operand1);
4737 if (type1 == &PyBytes_Type) {
4743 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4745 PyObject *x = PyBytes_Type.tp_as_sequence->sq_concat(operand1, operand2);
4746 assert(x != Py_NotImplemented);
4749 goto exit_result_object;
4752 if (unlikely(obj_result == NULL)) {
4753 goto exit_result_exception;
4755 result = obj_result;
4756 goto exit_result_ok;
4761 exit_result_exception:
4765 return __BINARY_OPERATION_ADD_OBJECT_OBJECT_BYTES(operand1, operand2);
4768PyObject *BINARY_OPERATION_ADD_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
4769 return _BINARY_OPERATION_ADD_OBJECT_OBJECT_BYTES(operand1, operand2);
4773#if PYTHON_VERSION >= 0x300
4775static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_BYTES_OBJECT(PyObject *operand1,
4776 PyObject *operand2) {
4777 PyTypeObject *type2 = Py_TYPE(operand2);
4779#if defined(_MSC_VER)
4780#pragma warning(push)
4781#pragma warning(disable : 4101)
4783 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4784 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4785#if defined(_MSC_VER)
4789 binaryfunc slot2 = NULL;
4791 if (!(&PyBytes_Type == type2)) {
4794 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
4797 if (slot2 != NULL) {
4798 PyObject *x = slot2(operand1, operand2);
4800 if (x != Py_NotImplemented) {
4802 goto exit_binary_result_object;
4805 Py_DECREF_IMMORTAL(x);
4808#if PYTHON_VERSION < 0x300
4809 if (!0 || !NEW_STYLE_NUMBER_TYPE(type2)) {
4811 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4814 PyObject *coerced1 = operand1;
4815 PyObject *coerced2 = operand2;
4817 int err = c2(&coerced2, &coerced1);
4819 if (unlikely(err < 0)) {
4820 goto exit_binary_exception;
4824 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4826 if (likely(mv == NULL)) {
4827 binaryfunc slot = mv->nb_add;
4829 if (likely(slot != NULL)) {
4830 PyObject *x = slot(coerced1, coerced2);
4832 Py_DECREF(coerced1);
4833 Py_DECREF(coerced2);
4836 goto exit_binary_result_object;
4841 Py_DECREF(coerced1);
4842 Py_DECREF(coerced2);
4849 PyObject *o = PyBytes_Type.tp_as_sequence->sq_concat(operand1, operand2);
4851 goto exit_binary_result_object;
4854 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
4856exit_binary_result_object:
4859#if PYTHON_VERSION < 0x300
4860exit_binary_exception:
4864static PyObject *_BINARY_OPERATION_ADD_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *operand2) {
4865 CHECK_OBJECT(operand1);
4866 assert(PyBytes_CheckExact(operand1));
4867 CHECK_OBJECT(operand2);
4869 PyTypeObject *type2 = Py_TYPE(operand2);
4871 if (&PyBytes_Type == type2) {
4877 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4879 PyObject *x = PyBytes_Type.tp_as_sequence->sq_concat(operand1, operand2);
4880 assert(x != Py_NotImplemented);
4883 goto exit_result_object;
4886 if (unlikely(obj_result == NULL)) {
4887 goto exit_result_exception;
4889 result = obj_result;
4890 goto exit_result_ok;
4895 exit_result_exception:
4899 return __BINARY_OPERATION_ADD_OBJECT_BYTES_OBJECT(operand1, operand2);
4902PyObject *BINARY_OPERATION_ADD_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *operand2) {
4903 return _BINARY_OPERATION_ADD_OBJECT_BYTES_OBJECT(operand1, operand2);
4908static PyObject *_BINARY_OPERATION_ADD_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *operand2) {
4909 CHECK_OBJECT(operand1);
4910 assert(PyTuple_CheckExact(operand1));
4911 CHECK_OBJECT(operand2);
4912 assert(PyTuple_CheckExact(operand2));
4917 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4920 PyThreadState *tstate = PyThreadState_GET();
4922 PyObject *x = TUPLE_CONCAT(tstate, operand1, operand2);
4924 assert(x != Py_NotImplemented);
4926 goto exit_result_object;
4929 if (unlikely(obj_result == NULL)) {
4930 goto exit_result_exception;
4932 result = obj_result;
4933 goto exit_result_ok;
4938exit_result_exception:
4942PyObject *BINARY_OPERATION_ADD_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *operand2) {
4943 return _BINARY_OPERATION_ADD_OBJECT_TUPLE_TUPLE(operand1, operand2);
4947static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_OBJECT_TUPLE(PyObject *operand1,
4948 PyObject *operand2) {
4949 PyTypeObject *type1 = Py_TYPE(operand1);
4951#if defined(_MSC_VER)
4952#pragma warning(push)
4953#pragma warning(disable : 4101)
4955 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4956 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4957#if defined(_MSC_VER)
4962 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
4964 if (slot1 != NULL) {
4965 PyObject *x = slot1(operand1, operand2);
4967 if (x != Py_NotImplemented) {
4969 goto exit_binary_result_object;
4972 Py_DECREF_IMMORTAL(x);
4975#if PYTHON_VERSION < 0x300
4976 if (!NEW_STYLE_NUMBER_TYPE(type1) || !0) {
4978 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
4981 PyObject *coerced1 = operand1;
4982 PyObject *coerced2 = operand2;
4984 int err = c1(&coerced1, &coerced2);
4986 if (unlikely(err < 0)) {
4987 goto exit_binary_exception;
4991 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4993 if (likely(mv == NULL)) {
4994 binaryfunc slot = mv->nb_add;
4996 if (likely(slot != NULL)) {
4997 PyObject *x = slot(coerced1, coerced2);
4999 Py_DECREF(coerced1);
5000 Py_DECREF(coerced2);
5003 goto exit_binary_result_object;
5008 Py_DECREF(coerced1);
5009 Py_DECREF(coerced2);
5017 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
5019 if (sq_slot != NULL) {
5020 PyObject *result = sq_slot(operand1, operand2);
5022 obj_result = result;
5023 goto exit_binary_result_object;
5027 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'tuple'", type1->tp_name);
5028 goto exit_binary_exception;
5030exit_binary_result_object:
5033exit_binary_exception:
5036static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *operand2) {
5037 CHECK_OBJECT(operand1);
5038 CHECK_OBJECT(operand2);
5039 assert(PyTuple_CheckExact(operand2));
5041 PyTypeObject *type1 = Py_TYPE(operand1);
5043 if (type1 == &PyTuple_Type) {
5049 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5052 PyThreadState *tstate = PyThreadState_GET();
5054 PyObject *x = TUPLE_CONCAT(tstate, operand1, operand2);
5056 assert(x != Py_NotImplemented);
5058 goto exit_result_object;
5061 if (unlikely(obj_result == NULL)) {
5062 goto exit_result_exception;
5064 result = obj_result;
5065 goto exit_result_ok;
5070 exit_result_exception:
5074 return __BINARY_OPERATION_ADD_OBJECT_OBJECT_TUPLE(operand1, operand2);
5077PyObject *BINARY_OPERATION_ADD_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *operand2) {
5078 return _BINARY_OPERATION_ADD_OBJECT_OBJECT_TUPLE(operand1, operand2);
5082static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_TUPLE_OBJECT(PyObject *operand1,
5083 PyObject *operand2) {
5084 PyTypeObject *type2 = Py_TYPE(operand2);
5086#if defined(_MSC_VER)
5087#pragma warning(push)
5088#pragma warning(disable : 4101)
5090 NUITKA_MAY_BE_UNUSED
bool cbool_result;
5091 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5092#if defined(_MSC_VER)
5096 binaryfunc slot2 = NULL;
5098 if (!(&PyTuple_Type == type2)) {
5101 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
5104 if (slot2 != NULL) {
5105 PyObject *x = slot2(operand1, operand2);
5107 if (x != Py_NotImplemented) {
5109 goto exit_binary_result_object;
5112 Py_DECREF_IMMORTAL(x);
5115#if PYTHON_VERSION < 0x300
5116 if (!0 || !NEW_STYLE_NUMBER_TYPE(type2)) {
5118 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
5121 PyObject *coerced1 = operand1;
5122 PyObject *coerced2 = operand2;
5124 int err = c2(&coerced2, &coerced1);
5126 if (unlikely(err < 0)) {
5127 goto exit_binary_exception;
5131 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
5133 if (likely(mv == NULL)) {
5134 binaryfunc slot = mv->nb_add;
5136 if (likely(slot != NULL)) {
5137 PyObject *x = slot(coerced1, coerced2);
5139 Py_DECREF(coerced1);
5140 Py_DECREF(coerced2);
5143 goto exit_binary_result_object;
5148 Py_DECREF(coerced1);
5149 Py_DECREF(coerced2);
5156 PyObject *o = PyTuple_Type.tp_as_sequence->sq_concat(operand1, operand2);
5158 goto exit_binary_result_object;
5161 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
5163exit_binary_result_object:
5166#if PYTHON_VERSION < 0x300
5167exit_binary_exception:
5171static PyObject *_BINARY_OPERATION_ADD_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *operand2) {
5172 CHECK_OBJECT(operand1);
5173 assert(PyTuple_CheckExact(operand1));
5174 CHECK_OBJECT(operand2);
5176 PyTypeObject *type2 = Py_TYPE(operand2);
5178 if (&PyTuple_Type == type2) {
5184 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5187 PyThreadState *tstate = PyThreadState_GET();
5189 PyObject *x = TUPLE_CONCAT(tstate, operand1, operand2);
5191 assert(x != Py_NotImplemented);
5193 goto exit_result_object;
5196 if (unlikely(obj_result == NULL)) {
5197 goto exit_result_exception;
5199 result = obj_result;
5200 goto exit_result_ok;
5205 exit_result_exception:
5209 return __BINARY_OPERATION_ADD_OBJECT_TUPLE_OBJECT(operand1, operand2);
5212PyObject *BINARY_OPERATION_ADD_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *operand2) {
5213 return _BINARY_OPERATION_ADD_OBJECT_TUPLE_OBJECT(operand1, operand2);
5217static PyObject *_BINARY_OPERATION_ADD_OBJECT_LIST_LIST(PyObject *operand1, PyObject *operand2) {
5218 CHECK_OBJECT(operand1);
5219 assert(PyList_CheckExact(operand1));
5220 CHECK_OBJECT(operand2);
5221 assert(PyList_CheckExact(operand2));
5226 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5229 PyThreadState *tstate = PyThreadState_GET();
5231 PyObject *x = LIST_CONCAT(tstate, operand1, operand2);
5232 assert(x != Py_NotImplemented);
5235 goto exit_result_object;
5238 if (unlikely(obj_result == NULL)) {
5239 goto exit_result_exception;
5241 result = obj_result;
5242 goto exit_result_ok;
5247exit_result_exception:
5251PyObject *BINARY_OPERATION_ADD_OBJECT_LIST_LIST(PyObject *operand1, PyObject *operand2) {
5252 return _BINARY_OPERATION_ADD_OBJECT_LIST_LIST(operand1, operand2);
5256static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *operand2) {
5257 PyTypeObject *type1 = Py_TYPE(operand1);
5259#if defined(_MSC_VER)
5260#pragma warning(push)
5261#pragma warning(disable : 4101)
5263 NUITKA_MAY_BE_UNUSED
bool cbool_result;
5264 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5265#if defined(_MSC_VER)
5270 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
5272 if (slot1 != NULL) {
5273 PyObject *x = slot1(operand1, operand2);
5275 if (x != Py_NotImplemented) {
5277 goto exit_binary_result_object;
5280 Py_DECREF_IMMORTAL(x);
5283#if PYTHON_VERSION < 0x300
5284 if (!NEW_STYLE_NUMBER_TYPE(type1) || !0) {
5286 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
5289 PyObject *coerced1 = operand1;
5290 PyObject *coerced2 = operand2;
5292 int err = c1(&coerced1, &coerced2);
5294 if (unlikely(err < 0)) {
5295 goto exit_binary_exception;
5299 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
5301 if (likely(mv == NULL)) {
5302 binaryfunc slot = mv->nb_add;
5304 if (likely(slot != NULL)) {
5305 PyObject *x = slot(coerced1, coerced2);
5307 Py_DECREF(coerced1);
5308 Py_DECREF(coerced2);
5311 goto exit_binary_result_object;
5316 Py_DECREF(coerced1);
5317 Py_DECREF(coerced2);
5325 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
5327 if (sq_slot != NULL) {
5328 PyObject *result = sq_slot(operand1, operand2);
5330 obj_result = result;
5331 goto exit_binary_result_object;
5335 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'list'", type1->tp_name);
5336 goto exit_binary_exception;
5338exit_binary_result_object:
5341exit_binary_exception:
5344static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *operand2) {
5345 CHECK_OBJECT(operand1);
5346 CHECK_OBJECT(operand2);
5347 assert(PyList_CheckExact(operand2));
5349 PyTypeObject *type1 = Py_TYPE(operand1);
5351 if (type1 == &PyList_Type) {
5357 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5360 PyThreadState *tstate = PyThreadState_GET();
5362 PyObject *x = LIST_CONCAT(tstate, operand1, operand2);
5363 assert(x != Py_NotImplemented);
5366 goto exit_result_object;
5369 if (unlikely(obj_result == NULL)) {
5370 goto exit_result_exception;
5372 result = obj_result;
5373 goto exit_result_ok;
5378 exit_result_exception:
5382 return __BINARY_OPERATION_ADD_OBJECT_OBJECT_LIST(operand1, operand2);
5385PyObject *BINARY_OPERATION_ADD_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *operand2) {
5386 return _BINARY_OPERATION_ADD_OBJECT_OBJECT_LIST(operand1, operand2);
5390static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_ADD_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *operand2) {
5391 PyTypeObject *type2 = Py_TYPE(operand2);
5393#if defined(_MSC_VER)
5394#pragma warning(push)
5395#pragma warning(disable : 4101)
5397 NUITKA_MAY_BE_UNUSED
bool cbool_result;
5398 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5399#if defined(_MSC_VER)
5403 binaryfunc slot2 = NULL;
5405 if (!(&PyList_Type == type2)) {
5408 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
5411 if (slot2 != NULL) {
5412 PyObject *x = slot2(operand1, operand2);
5414 if (x != Py_NotImplemented) {
5416 goto exit_binary_result_object;
5419 Py_DECREF_IMMORTAL(x);
5422#if PYTHON_VERSION < 0x300
5423 if (!0 || !NEW_STYLE_NUMBER_TYPE(type2)) {
5425 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
5428 PyObject *coerced1 = operand1;
5429 PyObject *coerced2 = operand2;
5431 int err = c2(&coerced2, &coerced1);
5433 if (unlikely(err < 0)) {
5434 goto exit_binary_exception;
5438 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
5440 if (likely(mv == NULL)) {
5441 binaryfunc slot = mv->nb_add;
5443 if (likely(slot != NULL)) {
5444 PyObject *x = slot(coerced1, coerced2);
5446 Py_DECREF(coerced1);
5447 Py_DECREF(coerced2);
5450 goto exit_binary_result_object;
5455 Py_DECREF(coerced1);
5456 Py_DECREF(coerced2);
5463 PyObject *o = PyList_Type.tp_as_sequence->sq_concat(operand1, operand2);
5465 goto exit_binary_result_object;
5468 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
5470exit_binary_result_object:
5473#if PYTHON_VERSION < 0x300
5474exit_binary_exception:
5478static PyObject *_BINARY_OPERATION_ADD_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *operand2) {
5479 CHECK_OBJECT(operand1);
5480 assert(PyList_CheckExact(operand1));
5481 CHECK_OBJECT(operand2);
5483 PyTypeObject *type2 = Py_TYPE(operand2);
5485 if (&PyList_Type == type2) {
5491 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5494 PyThreadState *tstate = PyThreadState_GET();
5496 PyObject *x = LIST_CONCAT(tstate, operand1, operand2);
5497 assert(x != Py_NotImplemented);
5500 goto exit_result_object;
5503 if (unlikely(obj_result == NULL)) {
5504 goto exit_result_exception;
5506 result = obj_result;
5507 goto exit_result_ok;
5512 exit_result_exception:
5516 return __BINARY_OPERATION_ADD_OBJECT_LIST_OBJECT(operand1, operand2);
5519PyObject *BINARY_OPERATION_ADD_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *operand2) {
5520 return _BINARY_OPERATION_ADD_OBJECT_LIST_OBJECT(operand1, operand2);
5524static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_LIST_LIST(PyObject *operand1, PyObject *operand2) {
5525 CHECK_OBJECT(operand1);
5526 assert(PyList_CheckExact(operand1));
5527 CHECK_OBJECT(operand2);
5528 assert(PyList_CheckExact(operand2));
5533 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5536 PyThreadState *tstate = PyThreadState_GET();
5538 PyObject *x = LIST_CONCAT(tstate, operand1, operand2);
5539 assert(x != Py_NotImplemented);
5542 goto exit_result_object;
5545 if (unlikely(obj_result == NULL)) {
5546 goto exit_result_exception;
5548 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5549 Py_DECREF(obj_result);
5550 goto exit_result_ok;
5555exit_result_exception:
5556 return NUITKA_BOOL_EXCEPTION;
5559nuitka_bool BINARY_OPERATION_ADD_NBOOL_LIST_LIST(PyObject *operand1, PyObject *operand2) {
5560 return _BINARY_OPERATION_ADD_NBOOL_LIST_LIST(operand1, operand2);
5564static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_ADD_NBOOL_OBJECT_LIST(PyObject *operand1,
5565 PyObject *operand2) {
5566 PyTypeObject *type1 = Py_TYPE(operand1);
5568#if defined(_MSC_VER)
5569#pragma warning(push)
5570#pragma warning(disable : 4101)
5572 NUITKA_MAY_BE_UNUSED
bool cbool_result;
5573 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5574#if defined(_MSC_VER)
5579 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
5581 if (slot1 != NULL) {
5582 PyObject *x = slot1(operand1, operand2);
5584 if (x != Py_NotImplemented) {
5586 goto exit_binary_result_object;
5589 Py_DECREF_IMMORTAL(x);
5592#if PYTHON_VERSION < 0x300
5593 if (!NEW_STYLE_NUMBER_TYPE(type1) || !0) {
5595 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
5598 PyObject *coerced1 = operand1;
5599 PyObject *coerced2 = operand2;
5601 int err = c1(&coerced1, &coerced2);
5603 if (unlikely(err < 0)) {
5604 goto exit_binary_exception;
5608 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
5610 if (likely(mv == NULL)) {
5611 binaryfunc slot = mv->nb_add;
5613 if (likely(slot != NULL)) {
5614 PyObject *x = slot(coerced1, coerced2);
5616 Py_DECREF(coerced1);
5617 Py_DECREF(coerced2);
5620 goto exit_binary_result_object;
5625 Py_DECREF(coerced1);
5626 Py_DECREF(coerced2);
5634 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
5636 if (sq_slot != NULL) {
5637 PyObject *result = sq_slot(operand1, operand2);
5639 obj_result = result;
5640 goto exit_binary_result_object;
5644 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and 'list'", type1->tp_name);
5645 goto exit_binary_exception;
5647exit_binary_result_object:
5648 if (unlikely(obj_result == NULL)) {
5649 return NUITKA_BOOL_EXCEPTION;
5653 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5654 Py_DECREF(obj_result);
5658exit_binary_exception:
5659 return NUITKA_BOOL_EXCEPTION;
5661static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *operand2) {
5662 CHECK_OBJECT(operand1);
5663 CHECK_OBJECT(operand2);
5664 assert(PyList_CheckExact(operand2));
5666 PyTypeObject *type1 = Py_TYPE(operand1);
5668 if (type1 == &PyList_Type) {
5674 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5677 PyThreadState *tstate = PyThreadState_GET();
5679 PyObject *x = LIST_CONCAT(tstate, operand1, operand2);
5680 assert(x != Py_NotImplemented);
5683 goto exit_result_object;
5686 if (unlikely(obj_result == NULL)) {
5687 goto exit_result_exception;
5689 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5690 Py_DECREF(obj_result);
5691 goto exit_result_ok;
5696 exit_result_exception:
5697 return NUITKA_BOOL_EXCEPTION;
5700 return __BINARY_OPERATION_ADD_NBOOL_OBJECT_LIST(operand1, operand2);
5703nuitka_bool BINARY_OPERATION_ADD_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *operand2) {
5704 return _BINARY_OPERATION_ADD_NBOOL_OBJECT_LIST(operand1, operand2);
5708static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_ADD_NBOOL_LIST_OBJECT(PyObject *operand1,
5709 PyObject *operand2) {
5710 PyTypeObject *type2 = Py_TYPE(operand2);
5712#if defined(_MSC_VER)
5713#pragma warning(push)
5714#pragma warning(disable : 4101)
5716 NUITKA_MAY_BE_UNUSED
bool cbool_result;
5717 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5718#if defined(_MSC_VER)
5722 binaryfunc slot2 = NULL;
5724 if (!(&PyList_Type == type2)) {
5727 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
5730 if (slot2 != NULL) {
5731 PyObject *x = slot2(operand1, operand2);
5733 if (x != Py_NotImplemented) {
5735 goto exit_binary_result_object;
5738 Py_DECREF_IMMORTAL(x);
5741#if PYTHON_VERSION < 0x300
5742 if (!0 || !NEW_STYLE_NUMBER_TYPE(type2)) {
5744 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
5747 PyObject *coerced1 = operand1;
5748 PyObject *coerced2 = operand2;
5750 int err = c2(&coerced2, &coerced1);
5752 if (unlikely(err < 0)) {
5753 goto exit_binary_exception;
5757 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
5759 if (likely(mv == NULL)) {
5760 binaryfunc slot = mv->nb_add;
5762 if (likely(slot != NULL)) {
5763 PyObject *x = slot(coerced1, coerced2);
5765 Py_DECREF(coerced1);
5766 Py_DECREF(coerced2);
5769 goto exit_binary_result_object;
5774 Py_DECREF(coerced1);
5775 Py_DECREF(coerced2);
5782 PyObject *o = PyList_Type.tp_as_sequence->sq_concat(operand1, operand2);
5784 goto exit_binary_result_object;
5787 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
5789exit_binary_result_object:
5790 if (unlikely(obj_result == NULL)) {
5791 return NUITKA_BOOL_EXCEPTION;
5795 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5796 Py_DECREF(obj_result);
5800#if PYTHON_VERSION < 0x300
5801exit_binary_exception:
5802 return NUITKA_BOOL_EXCEPTION;
5805static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *operand2) {
5806 CHECK_OBJECT(operand1);
5807 assert(PyList_CheckExact(operand1));
5808 CHECK_OBJECT(operand2);
5810 PyTypeObject *type2 = Py_TYPE(operand2);
5812 if (&PyList_Type == type2) {
5818 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5821 PyThreadState *tstate = PyThreadState_GET();
5823 PyObject *x = LIST_CONCAT(tstate, operand1, operand2);
5824 assert(x != Py_NotImplemented);
5827 goto exit_result_object;
5830 if (unlikely(obj_result == NULL)) {
5831 goto exit_result_exception;
5833 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5834 Py_DECREF(obj_result);
5835 goto exit_result_ok;
5840 exit_result_exception:
5841 return NUITKA_BOOL_EXCEPTION;
5844 return __BINARY_OPERATION_ADD_NBOOL_LIST_OBJECT(operand1, operand2);
5847nuitka_bool BINARY_OPERATION_ADD_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *operand2) {
5848 return _BINARY_OPERATION_ADD_NBOOL_LIST_OBJECT(operand1, operand2);
5851#if PYTHON_VERSION < 0x300
5853static PyObject *_BINARY_OPERATION_ADD_OBJECT_UNICODE_STR(PyObject *operand1, PyObject *operand2) {
5854 CHECK_OBJECT(operand1);
5855 assert(PyUnicode_CheckExact(operand1));
5856 CHECK_OBJECT(operand2);
5857 assert(PyString_CheckExact(operand2));
5859#if defined(_MSC_VER)
5860#pragma warning(push)
5861#pragma warning(disable : 4101)
5863 NUITKA_MAY_BE_UNUSED
bool cbool_result;
5864 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5865#if defined(_MSC_VER)
5872 PyObject *o = PyUnicode_Type.tp_as_sequence->sq_concat(operand1, operand2);
5874 goto exit_binary_result_object;
5877 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
5879exit_binary_result_object:
5883PyObject *BINARY_OPERATION_ADD_OBJECT_UNICODE_STR(PyObject *operand1, PyObject *operand2) {
5884 return _BINARY_OPERATION_ADD_OBJECT_UNICODE_STR(operand1, operand2);
5888#if PYTHON_VERSION < 0x300
5890static PyObject *_BINARY_OPERATION_ADD_OBJECT_STR_UNICODE(PyObject *operand1, PyObject *operand2) {
5891 CHECK_OBJECT(operand1);
5892 assert(PyString_CheckExact(operand1));
5893 CHECK_OBJECT(operand2);
5894 assert(PyUnicode_CheckExact(operand2));
5896#if defined(_MSC_VER)
5897#pragma warning(push)
5898#pragma warning(disable : 4101)
5900 NUITKA_MAY_BE_UNUSED
bool cbool_result;
5901 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5902#if defined(_MSC_VER)
5909 PyObject *o = PyUnicode_Type.tp_as_sequence->sq_concat(operand1, operand2);
5911 goto exit_binary_result_object;
5914 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
5916exit_binary_result_object:
5920PyObject *BINARY_OPERATION_ADD_OBJECT_STR_UNICODE(PyObject *operand1, PyObject *operand2) {
5921 return _BINARY_OPERATION_ADD_OBJECT_STR_UNICODE(operand1, operand2);
5925#if PYTHON_VERSION < 0x300
5927static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_UNICODE_STR(PyObject *operand1, PyObject *operand2) {
5928 CHECK_OBJECT(operand1);
5929 assert(PyUnicode_CheckExact(operand1));
5930 CHECK_OBJECT(operand2);
5931 assert(PyString_CheckExact(operand2));
5933#if defined(_MSC_VER)
5934#pragma warning(push)
5935#pragma warning(disable : 4101)
5937 NUITKA_MAY_BE_UNUSED
bool cbool_result;
5938 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5939#if defined(_MSC_VER)
5946 PyObject *o = PyUnicode_Type.tp_as_sequence->sq_concat(operand1, operand2);
5948 goto exit_binary_result_object;
5951 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
5953exit_binary_result_object:
5954 if (unlikely(obj_result == NULL)) {
5955 return NUITKA_BOOL_EXCEPTION;
5959 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5960 Py_DECREF(obj_result);
5965nuitka_bool BINARY_OPERATION_ADD_NBOOL_UNICODE_STR(PyObject *operand1, PyObject *operand2) {
5966 return _BINARY_OPERATION_ADD_NBOOL_UNICODE_STR(operand1, operand2);
5970#if PYTHON_VERSION < 0x300
5972static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_STR_UNICODE(PyObject *operand1, PyObject *operand2) {
5973 CHECK_OBJECT(operand1);
5974 assert(PyString_CheckExact(operand1));
5975 CHECK_OBJECT(operand2);
5976 assert(PyUnicode_CheckExact(operand2));
5978#if defined(_MSC_VER)
5979#pragma warning(push)
5980#pragma warning(disable : 4101)
5982 NUITKA_MAY_BE_UNUSED
bool cbool_result;
5983 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5984#if defined(_MSC_VER)
5991 PyObject *o = PyUnicode_Type.tp_as_sequence->sq_concat(operand1, operand2);
5993 goto exit_binary_result_object;
5996 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
5998exit_binary_result_object:
5999 if (unlikely(obj_result == NULL)) {
6000 return NUITKA_BOOL_EXCEPTION;
6004 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6005 Py_DECREF(obj_result);
6010nuitka_bool BINARY_OPERATION_ADD_NBOOL_STR_UNICODE(PyObject *operand1, PyObject *operand2) {
6011 return _BINARY_OPERATION_ADD_NBOOL_STR_UNICODE(operand1, operand2);
6016static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
6017 CHECK_OBJECT(operand1);
6018 CHECK_OBJECT(operand2);
6020#if PYTHON_VERSION < 0x300
6021 if (PyInt_CheckExact(operand1) && PyInt_CheckExact(operand2)) {
6025#if defined(_MSC_VER)
6026#pragma warning(push)
6027#pragma warning(disable : 4101)
6029 NUITKA_MAY_BE_UNUSED
bool cbool_result;
6030 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
6031 NUITKA_MAY_BE_UNUSED
long clong_result;
6032 NUITKA_MAY_BE_UNUSED
double cfloat_result;
6033#if defined(_MSC_VER)
6037 CHECK_OBJECT(operand1);
6038 assert(PyInt_CheckExact(operand1));
6039 CHECK_OBJECT(operand2);
6040 assert(PyInt_CheckExact(operand2));
6042 const long a = PyInt_AS_LONG(operand1);
6043 const long b = PyInt_AS_LONG(operand2);
6045 const long x = (long)((
unsigned long)a + b);
6046 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
6047 if (likely(no_overflow)) {
6049 goto exit_result_ok_clong;
6053 PyObject *operand1_object = operand1;
6054 PyObject *operand2_object = operand2;
6056 PyObject *r = PyLong_Type.tp_as_number->nb_add(operand1_object, operand2_object);
6057 assert(r != Py_NotImplemented);
6060 goto exit_result_object;
6063 exit_result_ok_clong:
6064 result = Nuitka_PyInt_FromLong(clong_result);
6065 goto exit_result_ok;
6068 if (unlikely(obj_result == NULL)) {
6069 goto exit_result_exception;
6071 result = obj_result;
6072 goto exit_result_ok;
6077 exit_result_exception:
6082 PyTypeObject *type1 = Py_TYPE(operand1);
6083 PyTypeObject *type2 = Py_TYPE(operand2);
6085#if defined(_MSC_VER)
6086#pragma warning(push)
6087#pragma warning(disable : 4101)
6089 NUITKA_MAY_BE_UNUSED
bool cbool_result;
6090 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
6091#if defined(_MSC_VER)
6096 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
6097 binaryfunc slot2 = NULL;
6099 if (!(type1 == type2)) {
6102 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
6104 if (slot1 == slot2) {
6109 if (slot1 != NULL) {
6110 if (slot2 != NULL) {
6111 if (Nuitka_Type_IsSubtype(type2, type1)) {
6112 PyObject *x = slot2(operand1, operand2);
6114 if (x != Py_NotImplemented) {
6116 goto exit_binary_result_object;
6119 Py_DECREF_IMMORTAL(x);
6124 PyObject *x = slot1(operand1, operand2);
6126 if (x != Py_NotImplemented) {
6128 goto exit_binary_result_object;
6131 Py_DECREF_IMMORTAL(x);
6134 if (slot2 != NULL) {
6135 PyObject *x = slot2(operand1, operand2);
6137 if (x != Py_NotImplemented) {
6139 goto exit_binary_result_object;
6142 Py_DECREF_IMMORTAL(x);
6145#if PYTHON_VERSION < 0x300
6146 if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
6148 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
6151 PyObject *coerced1 = operand1;
6152 PyObject *coerced2 = operand2;
6154 int err = c1(&coerced1, &coerced2);
6156 if (unlikely(err < 0)) {
6157 goto exit_binary_exception;
6161 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
6163 if (likely(mv == NULL)) {
6164 binaryfunc slot = mv->nb_add;
6166 if (likely(slot != NULL)) {
6167 PyObject *x = slot(coerced1, coerced2);
6169 Py_DECREF(coerced1);
6170 Py_DECREF(coerced2);
6173 goto exit_binary_result_object;
6178 Py_DECREF(coerced1);
6179 Py_DECREF(coerced2);
6183 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
6186 PyObject *coerced1 = operand1;
6187 PyObject *coerced2 = operand2;
6189 int err = c2(&coerced2, &coerced1);
6191 if (unlikely(err < 0)) {
6192 goto exit_binary_exception;
6196 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
6198 if (likely(mv == NULL)) {
6199 binaryfunc slot = mv->nb_add;
6201 if (likely(slot != NULL)) {
6202 PyObject *x = slot(coerced1, coerced2);
6204 Py_DECREF(coerced1);
6205 Py_DECREF(coerced2);
6208 goto exit_binary_result_object;
6213 Py_DECREF(coerced1);
6214 Py_DECREF(coerced2);
6222 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
6224 if (sq_slot != NULL) {
6225 PyObject *result = sq_slot(operand1, operand2);
6227 obj_result = result;
6228 goto exit_binary_result_object;
6232 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and '%s'", type1->tp_name, type2->tp_name);
6233 goto exit_binary_exception;
6235exit_binary_result_object:
6238exit_binary_exception:
6242PyObject *BINARY_OPERATION_ADD_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
6243 return _BINARY_OPERATION_ADD_OBJECT_OBJECT_OBJECT(operand1, operand2);
6247static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
6248 CHECK_OBJECT(operand1);
6249 CHECK_OBJECT(operand2);
6251#if PYTHON_VERSION < 0x300
6252 if (PyInt_CheckExact(operand1) && PyInt_CheckExact(operand2)) {
6256#if defined(_MSC_VER)
6257#pragma warning(push)
6258#pragma warning(disable : 4101)
6260 NUITKA_MAY_BE_UNUSED
bool cbool_result;
6261 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
6262 NUITKA_MAY_BE_UNUSED
long clong_result;
6263 NUITKA_MAY_BE_UNUSED
double cfloat_result;
6264#if defined(_MSC_VER)
6268 CHECK_OBJECT(operand1);
6269 assert(PyInt_CheckExact(operand1));
6270 CHECK_OBJECT(operand2);
6271 assert(PyInt_CheckExact(operand2));
6273 const long a = PyInt_AS_LONG(operand1);
6274 const long b = PyInt_AS_LONG(operand2);
6276 const long x = (long)((
unsigned long)a + b);
6277 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
6278 bool t = !no_overflow || x != 0;
6281 goto exit_result_ok_cbool;
6283 exit_result_ok_cbool:
6284 result = cbool_result ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6285 goto exit_result_ok;
6292 PyTypeObject *type1 = Py_TYPE(operand1);
6293 PyTypeObject *type2 = Py_TYPE(operand2);
6295#if defined(_MSC_VER)
6296#pragma warning(push)
6297#pragma warning(disable : 4101)
6299 NUITKA_MAY_BE_UNUSED
bool cbool_result;
6300 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
6301#if defined(_MSC_VER)
6306 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
6307 binaryfunc slot2 = NULL;
6309 if (!(type1 == type2)) {
6312 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
6314 if (slot1 == slot2) {
6319 if (slot1 != NULL) {
6320 if (slot2 != NULL) {
6321 if (Nuitka_Type_IsSubtype(type2, type1)) {
6322 PyObject *x = slot2(operand1, operand2);
6324 if (x != Py_NotImplemented) {
6326 goto exit_binary_result_object;
6329 Py_DECREF_IMMORTAL(x);
6334 PyObject *x = slot1(operand1, operand2);
6336 if (x != Py_NotImplemented) {
6338 goto exit_binary_result_object;
6341 Py_DECREF_IMMORTAL(x);
6344 if (slot2 != NULL) {
6345 PyObject *x = slot2(operand1, operand2);
6347 if (x != Py_NotImplemented) {
6349 goto exit_binary_result_object;
6352 Py_DECREF_IMMORTAL(x);
6355#if PYTHON_VERSION < 0x300
6356 if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
6358 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
6361 PyObject *coerced1 = operand1;
6362 PyObject *coerced2 = operand2;
6364 int err = c1(&coerced1, &coerced2);
6366 if (unlikely(err < 0)) {
6367 goto exit_binary_exception;
6371 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
6373 if (likely(mv == NULL)) {
6374 binaryfunc slot = mv->nb_add;
6376 if (likely(slot != NULL)) {
6377 PyObject *x = slot(coerced1, coerced2);
6379 Py_DECREF(coerced1);
6380 Py_DECREF(coerced2);
6383 goto exit_binary_result_object;
6388 Py_DECREF(coerced1);
6389 Py_DECREF(coerced2);
6393 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
6396 PyObject *coerced1 = operand1;
6397 PyObject *coerced2 = operand2;
6399 int err = c2(&coerced2, &coerced1);
6401 if (unlikely(err < 0)) {
6402 goto exit_binary_exception;
6406 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
6408 if (likely(mv == NULL)) {
6409 binaryfunc slot = mv->nb_add;
6411 if (likely(slot != NULL)) {
6412 PyObject *x = slot(coerced1, coerced2);
6414 Py_DECREF(coerced1);
6415 Py_DECREF(coerced2);
6418 goto exit_binary_result_object;
6423 Py_DECREF(coerced1);
6424 Py_DECREF(coerced2);
6432 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
6434 if (sq_slot != NULL) {
6435 PyObject *result = sq_slot(operand1, operand2);
6437 obj_result = result;
6438 goto exit_binary_result_object;
6442 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +: '%s' and '%s'", type1->tp_name, type2->tp_name);
6443 goto exit_binary_exception;
6445exit_binary_result_object:
6446 if (unlikely(obj_result == NULL)) {
6447 return NUITKA_BOOL_EXCEPTION;
6451 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6452 Py_DECREF(obj_result);
6456exit_binary_exception:
6457 return NUITKA_BOOL_EXCEPTION;
6460nuitka_bool BINARY_OPERATION_ADD_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
6461 return _BINARY_OPERATION_ADD_NBOOL_OBJECT_OBJECT(operand1, operand2);