7#include "nuitka/prelude.h"
10#include "HelpersOperationInplaceAddUtils.c"
13#if PYTHON_VERSION < 0x300
15static inline bool _INPLACE_OPERATION_ADD_INT_INT(PyObject **operand1, PyObject *operand2) {
18 CHECK_OBJECT(*operand1);
19 assert(PyInt_CheckExact(*operand1));
20 CHECK_OBJECT(operand2);
21 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;
69 *operand1 = Nuitka_PyInt_FromLong(clong_result);
73 if (unlikely(obj_result == NULL)) {
74 goto exit_result_exception;
79 *operand1 = obj_result;
89bool INPLACE_OPERATION_ADD_INT_INT(PyObject **operand1, PyObject *operand2) {
90 return _INPLACE_OPERATION_ADD_INT_INT(operand1, operand2);
94#if PYTHON_VERSION < 0x300
96static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
97 PyTypeObject *type1 = Py_TYPE(*operand1);
101#pragma warning(disable : 4101)
103 NUITKA_MAY_BE_UNUSED
bool cbool_result;
104 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
110 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_add : NULL;
113 PyObject *x = islot(*operand1, operand2);
115 if (x != Py_NotImplemented) {
117 goto exit_inplace_result_object;
120 Py_DECREF_IMMORTAL(x);
125 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
126 binaryfunc slot2 = NULL;
128 if (!(type1 == &PyInt_Type)) {
131 slot2 = PyInt_Type.tp_as_number->nb_add;
133 if (slot1 == slot2) {
139 PyObject *x = slot1(*operand1, operand2);
141 if (x != Py_NotImplemented) {
143 goto exit_inplace_result_object;
146 Py_DECREF_IMMORTAL(x);
150 PyObject *x = slot2(*operand1, operand2);
152 if (x != Py_NotImplemented) {
154 goto exit_inplace_result_object;
157 Py_DECREF_IMMORTAL(x);
160#if PYTHON_VERSION < 0x300
161 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
163 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
166 PyObject *coerced1 = *operand1;
167 PyObject *coerced2 = operand2;
169 int err = c1(&coerced1, &coerced2);
171 if (unlikely(err < 0)) {
172 goto exit_inplace_exception;
176 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
178 if (likely(mv == NULL)) {
179 binaryfunc slot = mv->nb_add;
181 if (likely(slot != NULL)) {
182 PyObject *x = slot(coerced1, coerced2);
188 goto exit_inplace_result_object;
197 coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
200 PyObject *coerced1 = *operand1;
201 PyObject *coerced2 = operand2;
203 int err = c2(&coerced2, &coerced1);
205 if (unlikely(err < 0)) {
206 goto exit_inplace_exception;
210 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
212 if (likely(mv == NULL)) {
213 binaryfunc slot = mv->nb_add;
215 if (likely(slot != NULL)) {
216 PyObject *x = slot(coerced1, coerced2);
222 goto exit_inplace_result_object;
236 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_concat : NULL;
237 if (sq_slot == NULL) {
238 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
241 if (sq_slot != NULL) {
242 PyObject *result = sq_slot(*operand1, operand2);
245 goto exit_inplace_result_object;
249 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: '%s' and 'int'", type1->tp_name);
250 goto exit_inplace_exception;
253exit_inplace_result_object:
254 if (unlikely(obj_result == NULL)) {
259 Py_DECREF(*operand1);
263 *operand1 = obj_result;
267exit_inplace_exception:
270static inline bool _INPLACE_OPERATION_ADD_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
273 CHECK_OBJECT(*operand1);
274 CHECK_OBJECT(operand2);
275 assert(PyInt_CheckExact(operand2));
277 PyTypeObject *type1 = Py_TYPE(*operand1);
279 if (type1 == &PyInt_Type) {
285#pragma warning(disable : 4101)
287 NUITKA_MAY_BE_UNUSED
bool cbool_result;
288 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
289 NUITKA_MAY_BE_UNUSED
long clong_result;
290 NUITKA_MAY_BE_UNUSED
double cfloat_result;
295 CHECK_OBJECT(*operand1);
296 assert(PyInt_CheckExact(*operand1));
297 CHECK_OBJECT(operand2);
298 assert(PyInt_CheckExact(operand2));
300 const long a = PyInt_AS_LONG(*operand1);
301 const long b = PyInt_AS_LONG(operand2);
303 const long x = (long)((
unsigned long)a + b);
304 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
305 if (likely(no_overflow)) {
307 goto exit_result_ok_clong;
311 PyObject *operand1_object = *operand1;
312 PyObject *operand2_object = operand2;
314 PyObject *r = PyLong_Type.tp_as_number->nb_add(operand1_object, operand2_object);
315 assert(r != Py_NotImplemented);
318 goto exit_result_object;
321 exit_result_ok_clong:
324 Py_DECREF(*operand1);
328 *operand1 = Nuitka_PyInt_FromLong(clong_result);
332 if (unlikely(obj_result == NULL)) {
333 goto exit_result_exception;
336 Py_DECREF(*operand1);
338 *operand1 = obj_result;
344 exit_result_exception:
348 return __INPLACE_OPERATION_ADD_OBJECT_INT(operand1, operand2);
351bool INPLACE_OPERATION_ADD_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
352 return _INPLACE_OPERATION_ADD_OBJECT_INT(operand1, operand2);
356#if PYTHON_VERSION < 0x300
358static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
359 PyTypeObject *type2 = Py_TYPE(operand2);
363#pragma warning(disable : 4101)
365 NUITKA_MAY_BE_UNUSED
bool cbool_result;
366 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
374 binaryfunc slot1 = PyInt_Type.tp_as_number->nb_add;
375 binaryfunc slot2 = NULL;
377 if (!(&PyInt_Type == type2)) {
380 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
382 if (slot1 == slot2) {
389 if (Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
390 PyObject *x = slot2(*operand1, operand2);
392 if (x != Py_NotImplemented) {
394 goto exit_inplace_result_object;
397 Py_DECREF_IMMORTAL(x);
402 PyObject *x = slot1(*operand1, operand2);
404 if (x != Py_NotImplemented) {
406 goto exit_inplace_result_object;
409 Py_DECREF_IMMORTAL(x);
413 PyObject *x = slot2(*operand1, operand2);
415 if (x != Py_NotImplemented) {
417 goto exit_inplace_result_object;
420 Py_DECREF_IMMORTAL(x);
423#if PYTHON_VERSION < 0x300
424 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
425 coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
428 PyObject *coerced1 = *operand1;
429 PyObject *coerced2 = operand2;
431 int err = c1(&coerced1, &coerced2);
433 if (unlikely(err < 0)) {
434 goto exit_inplace_exception;
438 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
440 if (likely(mv == NULL)) {
441 binaryfunc slot = mv->nb_add;
443 if (likely(slot != NULL)) {
444 PyObject *x = slot(coerced1, coerced2);
450 goto exit_inplace_result_object;
460 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
463 PyObject *coerced1 = *operand1;
464 PyObject *coerced2 = operand2;
466 int err = c2(&coerced2, &coerced1);
468 if (unlikely(err < 0)) {
469 goto exit_inplace_exception;
473 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
475 if (likely(mv == NULL)) {
476 binaryfunc slot = mv->nb_add;
478 if (likely(slot != NULL)) {
479 PyObject *x = slot(coerced1, coerced2);
485 goto exit_inplace_result_object;
502 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'int' and '%s'", type2->tp_name);
503 goto exit_inplace_exception;
506exit_inplace_result_object:
507 if (unlikely(obj_result == NULL)) {
512 Py_DECREF(*operand1);
516 *operand1 = obj_result;
520exit_inplace_exception:
523static inline bool _INPLACE_OPERATION_ADD_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
526 CHECK_OBJECT(*operand1);
527 assert(PyInt_CheckExact(*operand1));
528 CHECK_OBJECT(operand2);
530 PyTypeObject *type2 = Py_TYPE(operand2);
532 if (&PyInt_Type == type2) {
538#pragma warning(disable : 4101)
540 NUITKA_MAY_BE_UNUSED
bool cbool_result;
541 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
542 NUITKA_MAY_BE_UNUSED
long clong_result;
543 NUITKA_MAY_BE_UNUSED
double cfloat_result;
548 CHECK_OBJECT(*operand1);
549 assert(PyInt_CheckExact(*operand1));
550 CHECK_OBJECT(operand2);
551 assert(PyInt_CheckExact(operand2));
553 const long a = PyInt_AS_LONG(*operand1);
554 const long b = PyInt_AS_LONG(operand2);
556 const long x = (long)((
unsigned long)a + b);
557 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
558 if (likely(no_overflow)) {
560 goto exit_result_ok_clong;
564 PyObject *operand1_object = *operand1;
565 PyObject *operand2_object = operand2;
567 PyObject *r = PyLong_Type.tp_as_number->nb_add(operand1_object, operand2_object);
568 assert(r != Py_NotImplemented);
571 goto exit_result_object;
574 exit_result_ok_clong:
577 Py_DECREF(*operand1);
581 *operand1 = Nuitka_PyInt_FromLong(clong_result);
585 if (unlikely(obj_result == NULL)) {
586 goto exit_result_exception;
589 Py_DECREF(*operand1);
591 *operand1 = obj_result;
597 exit_result_exception:
601 return __INPLACE_OPERATION_ADD_INT_OBJECT(operand1, operand2);
604bool INPLACE_OPERATION_ADD_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
605 return _INPLACE_OPERATION_ADD_INT_OBJECT(operand1, operand2);
610static inline bool _INPLACE_OPERATION_ADD_LONG_LONG(PyObject **operand1, PyObject *operand2) {
613 CHECK_OBJECT(*operand1);
614 assert(PyLong_CheckExact(*operand1));
615 CHECK_OBJECT(operand2);
616 assert(PyLong_CheckExact(operand2));
621#pragma warning(disable : 4101)
623 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
624 NUITKA_MAY_BE_UNUSED
long clong_result;
629 PyLongObject *operand1_long_object = (PyLongObject *)*operand1;
631 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
633 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && Nuitka_LongGetDigitSize(operand2_long_object) <= 1) {
634 long r = (long)(MEDIUM_VALUE(operand1_long_object) + MEDIUM_VALUE(operand2_long_object));
636 if (Py_REFCNT(*operand1) == 1) {
637 Nuitka_LongUpdateFromCLong(&*operand1, (
long)r);
640 PyObject *obj = Nuitka_LongFromCLong(r);
643 goto exit_result_object;
646 goto exit_result_ok_clong;
649 if (Py_REFCNT(*operand1) == 1) {
650 digit
const *b_digits = Nuitka_LongGetDigitPointer(operand2_long_object);
651 Py_ssize_t b_digit_count = Nuitka_LongGetDigitSize(operand2_long_object);
653 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
654 bool b_negative = Nuitka_LongIsNegative(operand2_long_object);
658 *operand1 = _Nuitka_LongAddInplaceDigits(*operand1, b_digits, b_digit_count);
659 Nuitka_LongSetSignNegative(*operand1);
661 *operand1 = _Nuitka_LongSubInplaceDigits(*operand1, b_digits, b_digit_count, -1);
665 *operand1 = _Nuitka_LongSubInplaceDigits(*operand1, b_digits, b_digit_count, 1);
667 *operand1 = _Nuitka_LongAddInplaceDigits(*operand1, b_digits, b_digit_count);
676 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
677 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
678 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
679 digit
const *b_digits = Nuitka_LongGetDigitPointer(operand2_long_object);
680 Py_ssize_t b_digit_count = Nuitka_LongGetDigitSize(operand2_long_object);
681 bool b_negative = Nuitka_LongIsNegative(operand2_long_object);
685 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
686 Nuitka_LongFlipSign(z);
688 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
692 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
694 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
698 obj_result = (PyObject *)z;
699 goto exit_result_object;
703 if (unlikely(obj_result == NULL)) {
704 goto exit_result_exception;
707 Py_DECREF(*operand1);
708 *operand1 = obj_result;
714 Py_DECREF(*operand1);
718 *operand1 = Nuitka_PyLong_FromLong(clong_result);
724exit_result_exception:
728bool INPLACE_OPERATION_ADD_LONG_LONG(PyObject **operand1, PyObject *operand2) {
729 return _INPLACE_OPERATION_ADD_LONG_LONG(operand1, operand2);
733static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
734 PyTypeObject *type1 = Py_TYPE(*operand1);
738#pragma warning(disable : 4101)
740 NUITKA_MAY_BE_UNUSED
bool cbool_result;
741 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
747 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_add : NULL;
750 PyObject *x = islot(*operand1, operand2);
752 if (x != Py_NotImplemented) {
754 goto exit_inplace_result_object;
757 Py_DECREF_IMMORTAL(x);
762 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
763 binaryfunc slot2 = NULL;
765 if (!(type1 == &PyLong_Type)) {
768 slot2 = PyLong_Type.tp_as_number->nb_add;
770 if (slot1 == slot2) {
776 PyObject *x = slot1(*operand1, operand2);
778 if (x != Py_NotImplemented) {
780 goto exit_inplace_result_object;
783 Py_DECREF_IMMORTAL(x);
787 PyObject *x = slot2(*operand1, operand2);
789 if (x != Py_NotImplemented) {
791 goto exit_inplace_result_object;
794 Py_DECREF_IMMORTAL(x);
797#if PYTHON_VERSION < 0x300
798 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
800 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
803 PyObject *coerced1 = *operand1;
804 PyObject *coerced2 = operand2;
806 int err = c1(&coerced1, &coerced2);
808 if (unlikely(err < 0)) {
809 goto exit_inplace_exception;
813 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
815 if (likely(mv == NULL)) {
816 binaryfunc slot = mv->nb_add;
818 if (likely(slot != NULL)) {
819 PyObject *x = slot(coerced1, coerced2);
825 goto exit_inplace_result_object;
834 coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
837 PyObject *coerced1 = *operand1;
838 PyObject *coerced2 = operand2;
840 int err = c2(&coerced2, &coerced1);
842 if (unlikely(err < 0)) {
843 goto exit_inplace_exception;
847 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
849 if (likely(mv == NULL)) {
850 binaryfunc slot = mv->nb_add;
852 if (likely(slot != NULL)) {
853 PyObject *x = slot(coerced1, coerced2);
859 goto exit_inplace_result_object;
873 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_concat : NULL;
874 if (sq_slot == NULL) {
875 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
878 if (sq_slot != NULL) {
879 PyObject *result = sq_slot(*operand1, operand2);
882 goto exit_inplace_result_object;
886#if PYTHON_VERSION < 0x300
887 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: '%s' and 'long'", type1->tp_name);
889 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: '%s' and 'int'", type1->tp_name);
891 goto exit_inplace_exception;
894exit_inplace_result_object:
895 if (unlikely(obj_result == NULL)) {
900 Py_DECREF(*operand1);
904 *operand1 = obj_result;
908exit_inplace_exception:
911static inline bool _INPLACE_OPERATION_ADD_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
914 CHECK_OBJECT(*operand1);
915 CHECK_OBJECT(operand2);
916 assert(PyLong_CheckExact(operand2));
918 PyTypeObject *type1 = Py_TYPE(*operand1);
920 if (type1 == &PyLong_Type) {
926#pragma warning(disable : 4101)
928 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
929 NUITKA_MAY_BE_UNUSED
long clong_result;
934 PyLongObject *operand1_long_object = (PyLongObject *)*operand1;
936 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
938 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && Nuitka_LongGetDigitSize(operand2_long_object) <= 1) {
939 long r = (long)(MEDIUM_VALUE(operand1_long_object) + MEDIUM_VALUE(operand2_long_object));
941 if (Py_REFCNT(*operand1) == 1) {
942 Nuitka_LongUpdateFromCLong(&*operand1, (
long)r);
945 PyObject *obj = Nuitka_LongFromCLong(r);
948 goto exit_result_object;
951 goto exit_result_ok_clong;
954 if (Py_REFCNT(*operand1) == 1) {
955 digit
const *b_digits = Nuitka_LongGetDigitPointer(operand2_long_object);
956 Py_ssize_t b_digit_count = Nuitka_LongGetDigitSize(operand2_long_object);
958 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
959 bool b_negative = Nuitka_LongIsNegative(operand2_long_object);
963 *operand1 = _Nuitka_LongAddInplaceDigits(*operand1, b_digits, b_digit_count);
964 Nuitka_LongSetSignNegative(*operand1);
966 *operand1 = _Nuitka_LongSubInplaceDigits(*operand1, b_digits, b_digit_count, -1);
970 *operand1 = _Nuitka_LongSubInplaceDigits(*operand1, b_digits, b_digit_count, 1);
972 *operand1 = _Nuitka_LongAddInplaceDigits(*operand1, b_digits, b_digit_count);
981 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
982 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
983 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
984 digit
const *b_digits = Nuitka_LongGetDigitPointer(operand2_long_object);
985 Py_ssize_t b_digit_count = Nuitka_LongGetDigitSize(operand2_long_object);
986 bool b_negative = Nuitka_LongIsNegative(operand2_long_object);
990 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
991 Nuitka_LongFlipSign(z);
993 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
997 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
999 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
1003 obj_result = (PyObject *)z;
1004 goto exit_result_object;
1008 if (unlikely(obj_result == NULL)) {
1009 goto exit_result_exception;
1012 Py_DECREF(*operand1);
1013 *operand1 = obj_result;
1014 goto exit_result_ok;
1016 exit_result_ok_clong:
1019 Py_DECREF(*operand1);
1023 *operand1 = Nuitka_PyLong_FromLong(clong_result);
1024 goto exit_result_ok;
1029 exit_result_exception:
1033 return __INPLACE_OPERATION_ADD_OBJECT_LONG(operand1, operand2);
1036bool INPLACE_OPERATION_ADD_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
1037 return _INPLACE_OPERATION_ADD_OBJECT_LONG(operand1, operand2);
1041static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1042 PyTypeObject *type2 = Py_TYPE(operand2);
1044#if defined(_MSC_VER)
1045#pragma warning(push)
1046#pragma warning(disable : 4101)
1048 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1049 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1050#if defined(_MSC_VER)
1057 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_add;
1058 binaryfunc slot2 = NULL;
1060 if (!(&PyLong_Type == type2)) {
1063 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
1065 if (slot1 == slot2) {
1070 if (slot1 != NULL) {
1071 if (slot2 != NULL) {
1072 if (Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
1073 PyObject *x = slot2(*operand1, operand2);
1075 if (x != Py_NotImplemented) {
1077 goto exit_inplace_result_object;
1080 Py_DECREF_IMMORTAL(x);
1085 PyObject *x = slot1(*operand1, operand2);
1087 if (x != Py_NotImplemented) {
1089 goto exit_inplace_result_object;
1092 Py_DECREF_IMMORTAL(x);
1095 if (slot2 != NULL) {
1096 PyObject *x = slot2(*operand1, operand2);
1098 if (x != Py_NotImplemented) {
1100 goto exit_inplace_result_object;
1103 Py_DECREF_IMMORTAL(x);
1106#if PYTHON_VERSION < 0x300
1107 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1108 coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
1111 PyObject *coerced1 = *operand1;
1112 PyObject *coerced2 = operand2;
1114 int err = c1(&coerced1, &coerced2);
1116 if (unlikely(err < 0)) {
1117 goto exit_inplace_exception;
1121 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1123 if (likely(mv == NULL)) {
1124 binaryfunc slot = mv->nb_add;
1126 if (likely(slot != NULL)) {
1127 PyObject *x = slot(coerced1, coerced2);
1129 Py_DECREF(coerced1);
1130 Py_DECREF(coerced2);
1133 goto exit_inplace_result_object;
1138 Py_DECREF(coerced1);
1139 Py_DECREF(coerced2);
1143 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1146 PyObject *coerced1 = *operand1;
1147 PyObject *coerced2 = operand2;
1149 int err = c2(&coerced2, &coerced1);
1151 if (unlikely(err < 0)) {
1152 goto exit_inplace_exception;
1156 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1158 if (likely(mv == NULL)) {
1159 binaryfunc slot = mv->nb_add;
1161 if (likely(slot != NULL)) {
1162 PyObject *x = slot(coerced1, coerced2);
1164 Py_DECREF(coerced1);
1165 Py_DECREF(coerced2);
1168 goto exit_inplace_result_object;
1173 Py_DECREF(coerced1);
1174 Py_DECREF(coerced2);
1185#if PYTHON_VERSION < 0x300
1186 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'long' and '%s'", type2->tp_name);
1188 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'int' and '%s'", type2->tp_name);
1190 goto exit_inplace_exception;
1193exit_inplace_result_object:
1194 if (unlikely(obj_result == NULL)) {
1199 Py_DECREF(*operand1);
1203 *operand1 = obj_result;
1207exit_inplace_exception:
1210static inline bool _INPLACE_OPERATION_ADD_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1213 CHECK_OBJECT(*operand1);
1214 assert(PyLong_CheckExact(*operand1));
1215 CHECK_OBJECT(operand2);
1217 PyTypeObject *type2 = Py_TYPE(operand2);
1219 if (&PyLong_Type == type2) {
1223#if defined(_MSC_VER)
1224#pragma warning(push)
1225#pragma warning(disable : 4101)
1227 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1228 NUITKA_MAY_BE_UNUSED
long clong_result;
1229#if defined(_MSC_VER)
1233 PyLongObject *operand1_long_object = (PyLongObject *)*operand1;
1235 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
1237 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && Nuitka_LongGetDigitSize(operand2_long_object) <= 1) {
1238 long r = (long)(MEDIUM_VALUE(operand1_long_object) + MEDIUM_VALUE(operand2_long_object));
1240 if (Py_REFCNT(*operand1) == 1) {
1241 Nuitka_LongUpdateFromCLong(&*operand1, (
long)r);
1242 goto exit_result_ok;
1244 PyObject *obj = Nuitka_LongFromCLong(r);
1247 goto exit_result_object;
1250 goto exit_result_ok_clong;
1253 if (Py_REFCNT(*operand1) == 1) {
1254 digit
const *b_digits = Nuitka_LongGetDigitPointer(operand2_long_object);
1255 Py_ssize_t b_digit_count = Nuitka_LongGetDigitSize(operand2_long_object);
1257 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
1258 bool b_negative = Nuitka_LongIsNegative(operand2_long_object);
1262 *operand1 = _Nuitka_LongAddInplaceDigits(*operand1, b_digits, b_digit_count);
1263 Nuitka_LongSetSignNegative(*operand1);
1265 *operand1 = _Nuitka_LongSubInplaceDigits(*operand1, b_digits, b_digit_count, -1);
1269 *operand1 = _Nuitka_LongSubInplaceDigits(*operand1, b_digits, b_digit_count, 1);
1271 *operand1 = _Nuitka_LongAddInplaceDigits(*operand1, b_digits, b_digit_count);
1275 goto exit_result_ok;
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;
1311 Py_DECREF(*operand1);
1312 *operand1 = obj_result;
1313 goto exit_result_ok;
1315 exit_result_ok_clong:
1318 Py_DECREF(*operand1);
1322 *operand1 = Nuitka_PyLong_FromLong(clong_result);
1323 goto exit_result_ok;
1328 exit_result_exception:
1332 return __INPLACE_OPERATION_ADD_LONG_OBJECT(operand1, operand2);
1335bool INPLACE_OPERATION_ADD_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1336 return _INPLACE_OPERATION_ADD_LONG_OBJECT(operand1, operand2);
1340static inline bool _INPLACE_OPERATION_ADD_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1343 CHECK_OBJECT(*operand1);
1344 assert(PyFloat_CheckExact(*operand1));
1345 CHECK_OBJECT(operand2);
1346 assert(PyFloat_CheckExact(operand2));
1348#if defined(_MSC_VER)
1349#pragma warning(push)
1350#pragma warning(disable : 4101)
1353 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1354 NUITKA_MAY_BE_UNUSED
long clong_result;
1355 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1356#if defined(_MSC_VER)
1360 CHECK_OBJECT(*operand1);
1361 assert(PyFloat_CheckExact(*operand1));
1362 CHECK_OBJECT(operand2);
1363 assert(PyFloat_CheckExact(operand2));
1365 const double a = PyFloat_AS_DOUBLE(*operand1);
1366 const double b = PyFloat_AS_DOUBLE(operand2);
1371 goto exit_result_ok_cfloat;
1373exit_result_ok_cfloat:
1374 if (Py_REFCNT(*operand1) == 1) {
1375 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1378 Py_DECREF(*operand1);
1380 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1382 goto exit_result_ok;
1388bool INPLACE_OPERATION_ADD_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1389 return _INPLACE_OPERATION_ADD_FLOAT_FLOAT(operand1, operand2);
1393static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1394 PyTypeObject *type1 = Py_TYPE(*operand1);
1396#if defined(_MSC_VER)
1397#pragma warning(push)
1398#pragma warning(disable : 4101)
1400 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1401 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1402#if defined(_MSC_VER)
1407 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_add : NULL;
1409 if (islot != NULL) {
1410 PyObject *x = islot(*operand1, operand2);
1412 if (x != Py_NotImplemented) {
1414 goto exit_inplace_result_object;
1417 Py_DECREF_IMMORTAL(x);
1422 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
1423 binaryfunc slot2 = NULL;
1425 if (!(type1 == &PyFloat_Type)) {
1428 slot2 = PyFloat_Type.tp_as_number->nb_add;
1430 if (slot1 == slot2) {
1435 if (slot1 != NULL) {
1436 PyObject *x = slot1(*operand1, operand2);
1438 if (x != Py_NotImplemented) {
1440 goto exit_inplace_result_object;
1443 Py_DECREF_IMMORTAL(x);
1446 if (slot2 != NULL) {
1447 PyObject *x = slot2(*operand1, operand2);
1449 if (x != Py_NotImplemented) {
1451 goto exit_inplace_result_object;
1454 Py_DECREF_IMMORTAL(x);
1457#if PYTHON_VERSION < 0x300
1458 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1460 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1463 PyObject *coerced1 = *operand1;
1464 PyObject *coerced2 = operand2;
1466 int err = c1(&coerced1, &coerced2);
1468 if (unlikely(err < 0)) {
1469 goto exit_inplace_exception;
1473 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1475 if (likely(mv == NULL)) {
1476 binaryfunc slot = mv->nb_add;
1478 if (likely(slot != NULL)) {
1479 PyObject *x = slot(coerced1, coerced2);
1481 Py_DECREF(coerced1);
1482 Py_DECREF(coerced2);
1485 goto exit_inplace_result_object;
1490 Py_DECREF(coerced1);
1491 Py_DECREF(coerced2);
1494 coercion c2 = PyFloat_Type.tp_as_number->nb_coerce;
1497 PyObject *coerced1 = *operand1;
1498 PyObject *coerced2 = operand2;
1500 int err = c2(&coerced2, &coerced1);
1502 if (unlikely(err < 0)) {
1503 goto exit_inplace_exception;
1507 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1509 if (likely(mv == NULL)) {
1510 binaryfunc slot = mv->nb_add;
1512 if (likely(slot != NULL)) {
1513 PyObject *x = slot(coerced1, coerced2);
1515 Py_DECREF(coerced1);
1516 Py_DECREF(coerced2);
1519 goto exit_inplace_result_object;
1524 Py_DECREF(coerced1);
1525 Py_DECREF(coerced2);
1533 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_concat : NULL;
1534 if (sq_slot == NULL) {
1535 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
1538 if (sq_slot != NULL) {
1539 PyObject *result = sq_slot(*operand1, operand2);
1541 obj_result = result;
1542 goto exit_inplace_result_object;
1546 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: '%s' and 'float'", type1->tp_name);
1547 goto exit_inplace_exception;
1550exit_inplace_result_object:
1551 if (unlikely(obj_result == NULL)) {
1556 Py_DECREF(*operand1);
1560 *operand1 = obj_result;
1564exit_inplace_exception:
1567static inline bool _INPLACE_OPERATION_ADD_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1570 CHECK_OBJECT(*operand1);
1571 CHECK_OBJECT(operand2);
1572 assert(PyFloat_CheckExact(operand2));
1574 PyTypeObject *type1 = Py_TYPE(*operand1);
1576 if (type1 == &PyFloat_Type) {
1579#if defined(_MSC_VER)
1580#pragma warning(push)
1581#pragma warning(disable : 4101)
1584 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1585 NUITKA_MAY_BE_UNUSED
long clong_result;
1586 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1587#if defined(_MSC_VER)
1591 CHECK_OBJECT(*operand1);
1592 assert(PyFloat_CheckExact(*operand1));
1593 CHECK_OBJECT(operand2);
1594 assert(PyFloat_CheckExact(operand2));
1596 const double a = PyFloat_AS_DOUBLE(*operand1);
1597 const double b = PyFloat_AS_DOUBLE(operand2);
1602 goto exit_result_ok_cfloat;
1604 exit_result_ok_cfloat:
1605 if (Py_REFCNT(*operand1) == 1) {
1606 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1609 Py_DECREF(*operand1);
1611 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1613 goto exit_result_ok;
1619 return __INPLACE_OPERATION_ADD_OBJECT_FLOAT(operand1, operand2);
1622bool INPLACE_OPERATION_ADD_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1623 return _INPLACE_OPERATION_ADD_OBJECT_FLOAT(operand1, operand2);
1627static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1628 PyTypeObject *type2 = Py_TYPE(operand2);
1630#if defined(_MSC_VER)
1631#pragma warning(push)
1632#pragma warning(disable : 4101)
1634 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1635 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1636#if defined(_MSC_VER)
1643 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_add;
1644 binaryfunc slot2 = NULL;
1646 if (!(&PyFloat_Type == type2)) {
1649 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
1651 if (slot1 == slot2) {
1656 if (slot1 != NULL) {
1657 if (slot2 != NULL) {
1658 if (Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
1659 PyObject *x = slot2(*operand1, operand2);
1661 if (x != Py_NotImplemented) {
1663 goto exit_inplace_result_object;
1666 Py_DECREF_IMMORTAL(x);
1671 PyObject *x = slot1(*operand1, operand2);
1673 if (x != Py_NotImplemented) {
1675 goto exit_inplace_result_object;
1678 Py_DECREF_IMMORTAL(x);
1681 if (slot2 != NULL) {
1682 PyObject *x = slot2(*operand1, operand2);
1684 if (x != Py_NotImplemented) {
1686 goto exit_inplace_result_object;
1689 Py_DECREF_IMMORTAL(x);
1692#if PYTHON_VERSION < 0x300
1693 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1694 coercion c1 = PyFloat_Type.tp_as_number->nb_coerce;
1697 PyObject *coerced1 = *operand1;
1698 PyObject *coerced2 = operand2;
1700 int err = c1(&coerced1, &coerced2);
1702 if (unlikely(err < 0)) {
1703 goto exit_inplace_exception;
1707 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1709 if (likely(mv == NULL)) {
1710 binaryfunc slot = mv->nb_add;
1712 if (likely(slot != NULL)) {
1713 PyObject *x = slot(coerced1, coerced2);
1715 Py_DECREF(coerced1);
1716 Py_DECREF(coerced2);
1719 goto exit_inplace_result_object;
1724 Py_DECREF(coerced1);
1725 Py_DECREF(coerced2);
1729 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1732 PyObject *coerced1 = *operand1;
1733 PyObject *coerced2 = operand2;
1735 int err = c2(&coerced2, &coerced1);
1737 if (unlikely(err < 0)) {
1738 goto exit_inplace_exception;
1742 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1744 if (likely(mv == NULL)) {
1745 binaryfunc slot = mv->nb_add;
1747 if (likely(slot != NULL)) {
1748 PyObject *x = slot(coerced1, coerced2);
1750 Py_DECREF(coerced1);
1751 Py_DECREF(coerced2);
1754 goto exit_inplace_result_object;
1759 Py_DECREF(coerced1);
1760 Py_DECREF(coerced2);
1771 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'float' and '%s'", type2->tp_name);
1772 goto exit_inplace_exception;
1775exit_inplace_result_object:
1776 if (unlikely(obj_result == NULL)) {
1781 Py_DECREF(*operand1);
1785 *operand1 = obj_result;
1789exit_inplace_exception:
1792static inline bool _INPLACE_OPERATION_ADD_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1795 CHECK_OBJECT(*operand1);
1796 assert(PyFloat_CheckExact(*operand1));
1797 CHECK_OBJECT(operand2);
1799 PyTypeObject *type2 = Py_TYPE(operand2);
1801 if (&PyFloat_Type == type2) {
1804#if defined(_MSC_VER)
1805#pragma warning(push)
1806#pragma warning(disable : 4101)
1809 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1810 NUITKA_MAY_BE_UNUSED
long clong_result;
1811 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1812#if defined(_MSC_VER)
1816 CHECK_OBJECT(*operand1);
1817 assert(PyFloat_CheckExact(*operand1));
1818 CHECK_OBJECT(operand2);
1819 assert(PyFloat_CheckExact(operand2));
1821 const double a = PyFloat_AS_DOUBLE(*operand1);
1822 const double b = PyFloat_AS_DOUBLE(operand2);
1827 goto exit_result_ok_cfloat;
1829 exit_result_ok_cfloat:
1830 if (Py_REFCNT(*operand1) == 1) {
1831 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1834 Py_DECREF(*operand1);
1836 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1838 goto exit_result_ok;
1844 return __INPLACE_OPERATION_ADD_FLOAT_OBJECT(operand1, operand2);
1847bool INPLACE_OPERATION_ADD_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1848 return _INPLACE_OPERATION_ADD_FLOAT_OBJECT(operand1, operand2);
1852static inline bool _INPLACE_OPERATION_ADD_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1855 CHECK_OBJECT(*operand1);
1856 assert(PyFloat_CheckExact(*operand1));
1857 CHECK_OBJECT(operand2);
1858 assert(PyLong_CheckExact(operand2));
1860#if defined(_MSC_VER)
1861#pragma warning(push)
1862#pragma warning(disable : 4101)
1864 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1865 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1866#if defined(_MSC_VER)
1873 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_add;
1876 if (slot1 != NULL) {
1877 PyObject *x = slot1(*operand1, operand2);
1879 if (x != Py_NotImplemented) {
1881 goto exit_inplace_result_object;
1884 Py_DECREF_IMMORTAL(x);
1894#if PYTHON_VERSION < 0x300
1895 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'float' and 'long'");
1897 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'float' and 'int'");
1899 goto exit_inplace_exception;
1902exit_inplace_result_object:
1903 if (unlikely(obj_result == NULL)) {
1908 Py_DECREF(*operand1);
1912 *operand1 = obj_result;
1916exit_inplace_exception:
1920bool INPLACE_OPERATION_ADD_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1921 return _INPLACE_OPERATION_ADD_FLOAT_LONG(operand1, operand2);
1925static inline bool _INPLACE_OPERATION_ADD_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
1928 CHECK_OBJECT(*operand1);
1929 assert(PyLong_CheckExact(*operand1));
1930 CHECK_OBJECT(operand2);
1931 assert(PyFloat_CheckExact(operand2));
1933#if defined(_MSC_VER)
1934#pragma warning(push)
1935#pragma warning(disable : 4101)
1937 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1938 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1939#if defined(_MSC_VER)
1947 binaryfunc slot2 = NULL;
1952 slot2 = PyFloat_Type.tp_as_number->nb_add;
1955 if (slot2 != NULL) {
1956 PyObject *x = slot2(*operand1, operand2);
1958 if (x != Py_NotImplemented) {
1960 goto exit_inplace_result_object;
1963 Py_DECREF_IMMORTAL(x);
1973#if PYTHON_VERSION < 0x300
1974 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'long' and 'float'");
1976 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'int' and 'float'");
1978 goto exit_inplace_exception;
1981exit_inplace_result_object:
1982 if (unlikely(obj_result == NULL)) {
1987 Py_DECREF(*operand1);
1991 *operand1 = obj_result;
1995exit_inplace_exception:
1999bool INPLACE_OPERATION_ADD_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
2000 return _INPLACE_OPERATION_ADD_LONG_FLOAT(operand1, operand2);
2003#if PYTHON_VERSION < 0x300
2005static inline bool _INPLACE_OPERATION_ADD_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
2008 CHECK_OBJECT(*operand1);
2009 assert(PyFloat_CheckExact(*operand1));
2010 CHECK_OBJECT(operand2);
2011 assert(PyInt_CheckExact(operand2));
2013#if defined(_MSC_VER)
2014#pragma warning(push)
2015#pragma warning(disable : 4101)
2017 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2018 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2019#if defined(_MSC_VER)
2026 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_add;
2029 if (slot1 != NULL) {
2030 PyObject *x = slot1(*operand1, operand2);
2032 if (x != Py_NotImplemented) {
2034 goto exit_inplace_result_object;
2037 Py_DECREF_IMMORTAL(x);
2047 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'float' and 'int'");
2048 goto exit_inplace_exception;
2051exit_inplace_result_object:
2052 if (unlikely(obj_result == NULL)) {
2057 Py_DECREF(*operand1);
2061 *operand1 = obj_result;
2065exit_inplace_exception:
2069bool INPLACE_OPERATION_ADD_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
2070 return _INPLACE_OPERATION_ADD_FLOAT_INT(operand1, operand2);
2074#if PYTHON_VERSION < 0x300
2076static inline bool _INPLACE_OPERATION_ADD_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
2079 CHECK_OBJECT(*operand1);
2080 assert(PyInt_CheckExact(*operand1));
2081 CHECK_OBJECT(operand2);
2082 assert(PyFloat_CheckExact(operand2));
2084#if defined(_MSC_VER)
2085#pragma warning(push)
2086#pragma warning(disable : 4101)
2088 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2089 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2090#if defined(_MSC_VER)
2098 binaryfunc slot2 = NULL;
2103 slot2 = PyFloat_Type.tp_as_number->nb_add;
2106 if (slot2 != NULL) {
2107 PyObject *x = slot2(*operand1, operand2);
2109 if (x != Py_NotImplemented) {
2111 goto exit_inplace_result_object;
2114 Py_DECREF_IMMORTAL(x);
2124 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'int' and 'float'");
2125 goto exit_inplace_exception;
2128exit_inplace_result_object:
2129 if (unlikely(obj_result == NULL)) {
2134 Py_DECREF(*operand1);
2138 *operand1 = obj_result;
2142exit_inplace_exception:
2146bool INPLACE_OPERATION_ADD_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
2147 return _INPLACE_OPERATION_ADD_INT_FLOAT(operand1, operand2);
2151#if PYTHON_VERSION < 0x300
2153static inline bool _INPLACE_OPERATION_ADD_LONG_INT(PyObject **operand1, PyObject *operand2) {
2156 CHECK_OBJECT(*operand1);
2157 assert(PyLong_CheckExact(*operand1));
2158 CHECK_OBJECT(operand2);
2159 assert(PyInt_CheckExact(operand2));
2161#if defined(_MSC_VER)
2162#pragma warning(push)
2163#pragma warning(disable : 4101)
2165 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2166 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2167#if defined(_MSC_VER)
2174 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_add;
2177 if (slot1 != NULL) {
2178 PyObject *x = slot1(*operand1, operand2);
2180 if (x != Py_NotImplemented) {
2182 goto exit_inplace_result_object;
2185 Py_DECREF_IMMORTAL(x);
2195 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'long' and 'int'");
2196 goto exit_inplace_exception;
2199exit_inplace_result_object:
2200 if (unlikely(obj_result == NULL)) {
2205 Py_DECREF(*operand1);
2209 *operand1 = obj_result;
2213exit_inplace_exception:
2217bool INPLACE_OPERATION_ADD_LONG_INT(PyObject **operand1, PyObject *operand2) {
2218 return _INPLACE_OPERATION_ADD_LONG_INT(operand1, operand2);
2222#if PYTHON_VERSION < 0x300
2224static inline bool _INPLACE_OPERATION_ADD_INT_LONG(PyObject **operand1, PyObject *operand2) {
2227 CHECK_OBJECT(*operand1);
2228 assert(PyInt_CheckExact(*operand1));
2229 CHECK_OBJECT(operand2);
2230 assert(PyLong_CheckExact(operand2));
2232#if defined(_MSC_VER)
2233#pragma warning(push)
2234#pragma warning(disable : 4101)
2236 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2237 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2238#if defined(_MSC_VER)
2246 binaryfunc slot2 = NULL;
2251 slot2 = PyLong_Type.tp_as_number->nb_add;
2254 if (slot2 != NULL) {
2255 PyObject *x = slot2(*operand1, operand2);
2257 if (x != Py_NotImplemented) {
2259 goto exit_inplace_result_object;
2262 Py_DECREF_IMMORTAL(x);
2272 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: 'int' and 'long'");
2273 goto exit_inplace_exception;
2276exit_inplace_result_object:
2277 if (unlikely(obj_result == NULL)) {
2282 Py_DECREF(*operand1);
2286 *operand1 = obj_result;
2290exit_inplace_exception:
2294bool INPLACE_OPERATION_ADD_INT_LONG(PyObject **operand1, PyObject *operand2) {
2295 return _INPLACE_OPERATION_ADD_INT_LONG(operand1, operand2);
2299#if PYTHON_VERSION < 0x300
2301static inline bool _INPLACE_OPERATION_ADD_INT_CLONG(PyObject **operand1,
long operand2) {
2304 CHECK_OBJECT(*operand1);
2305 assert(PyInt_CheckExact(*operand1));
2308#if defined(_MSC_VER)
2309#pragma warning(push)
2310#pragma warning(disable : 4101)
2312 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2313 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2314 NUITKA_MAY_BE_UNUSED
long clong_result;
2315 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2316#if defined(_MSC_VER)
2320 CHECK_OBJECT(*operand1);
2321 assert(PyInt_CheckExact(*operand1));
2323 const long a = PyInt_AS_LONG(*operand1);
2324 const long b = operand2;
2326 const long x = (long)((
unsigned long)a + b);
2327 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
2328 if (likely(no_overflow)) {
2330 goto exit_result_ok_clong;
2334 PyObject *operand1_object = *operand1;
2335 PyObject *operand2_object = Nuitka_PyLong_FromLong(operand2);
2337 PyObject *r = PyLong_Type.tp_as_number->nb_add(operand1_object, operand2_object);
2338 assert(r != Py_NotImplemented);
2340 Py_DECREF(operand2_object);
2343 goto exit_result_object;
2346exit_result_ok_clong:
2349 Py_DECREF(*operand1);
2353 *operand1 = Nuitka_PyInt_FromLong(clong_result);
2354 goto exit_result_ok;
2357 if (unlikely(obj_result == NULL)) {
2358 goto exit_result_exception;
2361 Py_DECREF(*operand1);
2363 *operand1 = obj_result;
2364 goto exit_result_ok;
2369exit_result_exception:
2373bool INPLACE_OPERATION_ADD_INT_CLONG(PyObject **operand1,
long operand2) {
2374 return _INPLACE_OPERATION_ADD_INT_CLONG(operand1, operand2);
2380static inline bool _INPLACE_OPERATION_ADD_LONG_DIGIT(PyObject **operand1,
long operand2) {
2383 CHECK_OBJECT(*operand1);
2384 assert(PyLong_CheckExact(*operand1));
2385 assert(Py_ABS(operand2) < (1 << PyLong_SHIFT));
2388#if defined(_MSC_VER)
2389#pragma warning(push)
2390#pragma warning(disable : 4101)
2392 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2393 NUITKA_MAY_BE_UNUSED
long clong_result;
2394#if defined(_MSC_VER)
2398 PyLongObject *operand1_long_object = (PyLongObject *)*operand1;
2400 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && (operand2 == 0 ? 0 : 1) <= 1) {
2401 long r = (long)(MEDIUM_VALUE(operand1_long_object) + (sdigit)operand2);
2403 if (Py_REFCNT(*operand1) == 1) {
2404 Nuitka_LongUpdateFromCLong(&*operand1, (
long)r);
2405 goto exit_result_ok;
2407 PyObject *obj = Nuitka_LongFromCLong(r);
2410 goto exit_result_object;
2413 goto exit_result_ok_clong;
2416 if (Py_REFCNT(*operand1) == 1) {
2417 digit
const *b_digits = (digit *)&operand2;
2418 Py_ssize_t b_digit_count = (operand2 == 0 ? 0 : 1);
2420 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
2421 bool b_negative = operand2 < 0;
2425 *operand1 = _Nuitka_LongAddInplaceDigits(*operand1, b_digits, b_digit_count);
2426 Nuitka_LongSetSignNegative(*operand1);
2428 *operand1 = _Nuitka_LongSubInplaceDigits(*operand1, b_digits, b_digit_count, -1);
2432 *operand1 = _Nuitka_LongSubInplaceDigits(*operand1, b_digits, b_digit_count, 1);
2434 *operand1 = _Nuitka_LongAddInplaceDigits(*operand1, b_digits, b_digit_count);
2438 goto exit_result_ok;
2443 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
2444 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
2445 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
2446 digit
const *b_digits = (digit *)&operand2;
2447 Py_ssize_t b_digit_count = (operand2 == 0 ? 0 : 1);
2448 bool b_negative = operand2 < 0;
2452 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
2453 Nuitka_LongFlipSign(z);
2455 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
2459 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
2461 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
2465 obj_result = (PyObject *)z;
2466 goto exit_result_object;
2470 if (unlikely(obj_result == NULL)) {
2471 goto exit_result_exception;
2474 Py_DECREF(*operand1);
2475 *operand1 = obj_result;
2476 goto exit_result_ok;
2478exit_result_ok_clong:
2481 Py_DECREF(*operand1);
2485 *operand1 = Nuitka_PyLong_FromLong(clong_result);
2486 goto exit_result_ok;
2491exit_result_exception:
2495bool INPLACE_OPERATION_ADD_LONG_DIGIT(PyObject **operand1,
long operand2) {
2496 return _INPLACE_OPERATION_ADD_LONG_DIGIT(operand1, operand2);
2500static inline bool _INPLACE_OPERATION_ADD_LONG_CLONG(PyObject **operand1,
long operand2) {
2503 CHECK_OBJECT(*operand1);
2504 assert(PyLong_CheckExact(*operand1));
2507#if defined(_MSC_VER)
2508#pragma warning(push)
2509#pragma warning(disable : 4101)
2511 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2512 NUITKA_MAY_BE_UNUSED
long clong_result;
2513#if defined(_MSC_VER)
2517 PyLongObject *operand1_long_object = (PyLongObject *)*operand1;
2519 bool operand2_is_negative;
2520 unsigned long operand2_abs_ival;
2523 operand2_abs_ival = (
unsigned long)(-1 - operand2) + 1;
2524 operand2_is_negative =
true;
2526 operand2_abs_ival = (
unsigned long)operand2;
2527 operand2_is_negative =
false;
2530 Py_ssize_t operand2_digit_count = 0;
2531 digit operand2_digits[5] = {0};
2533 unsigned long t = operand2_abs_ival;
2536 operand2_digit_count += 1;
2537 assert(operand2_digit_count <= (Py_ssize_t)(
sizeof(operand2_digit_count) /
sizeof(digit)));
2539 operand2_digits[operand2_digit_count] = (digit)(t & PyLong_MASK);
2544 NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
2545 operand2_is_negative ==
false ? operand2_digit_count : -operand2_digit_count;
2547 if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && operand2_digit_count <= 1) {
2548 long r = (long)(MEDIUM_VALUE(operand1_long_object) + (sdigit)operand2);
2550 if (Py_REFCNT(*operand1) == 1) {
2551 Nuitka_LongUpdateFromCLong(&*operand1, (
long)r);
2552 goto exit_result_ok;
2554 PyObject *obj = Nuitka_LongFromCLong(r);
2557 goto exit_result_object;
2560 goto exit_result_ok_clong;
2563 if (Py_REFCNT(*operand1) == 1) {
2564 digit
const *b_digits = operand2_digits;
2565 Py_ssize_t b_digit_count = operand2_digit_count;
2567 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
2568 bool b_negative = operand2_is_negative;
2572 *operand1 = _Nuitka_LongAddInplaceDigits(*operand1, b_digits, b_digit_count);
2573 Nuitka_LongSetSignNegative(*operand1);
2575 *operand1 = _Nuitka_LongSubInplaceDigits(*operand1, b_digits, b_digit_count, -1);
2579 *operand1 = _Nuitka_LongSubInplaceDigits(*operand1, b_digits, b_digit_count, 1);
2581 *operand1 = _Nuitka_LongAddInplaceDigits(*operand1, b_digits, b_digit_count);
2585 goto exit_result_ok;
2590 digit
const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
2591 Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
2592 bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
2593 digit
const *b_digits = operand2_digits;
2594 Py_ssize_t b_digit_count = operand2_digit_count;
2595 bool b_negative = operand2_is_negative;
2599 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
2600 Nuitka_LongFlipSign(z);
2602 z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
2606 z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
2608 z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
2612 obj_result = (PyObject *)z;
2613 goto exit_result_object;
2617 if (unlikely(obj_result == NULL)) {
2618 goto exit_result_exception;
2621 Py_DECREF(*operand1);
2622 *operand1 = obj_result;
2623 goto exit_result_ok;
2625exit_result_ok_clong:
2628 Py_DECREF(*operand1);
2632 *operand1 = Nuitka_PyLong_FromLong(clong_result);
2633 goto exit_result_ok;
2638exit_result_exception:
2642bool INPLACE_OPERATION_ADD_LONG_CLONG(PyObject **operand1,
long operand2) {
2643 return _INPLACE_OPERATION_ADD_LONG_CLONG(operand1, operand2);
2647static inline bool _INPLACE_OPERATION_ADD_FLOAT_CFLOAT(PyObject **operand1,
double operand2) {
2650 CHECK_OBJECT(*operand1);
2651 assert(PyFloat_CheckExact(*operand1));
2653#if defined(_MSC_VER)
2654#pragma warning(push)
2655#pragma warning(disable : 4101)
2658 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2659 NUITKA_MAY_BE_UNUSED
long clong_result;
2660 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2661#if defined(_MSC_VER)
2665 CHECK_OBJECT(*operand1);
2666 assert(PyFloat_CheckExact(*operand1));
2668 const double a = PyFloat_AS_DOUBLE(*operand1);
2669 const double b = operand2;
2674 goto exit_result_ok_cfloat;
2676exit_result_ok_cfloat:
2677 if (Py_REFCNT(*operand1) == 1) {
2678 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
2681 Py_DECREF(*operand1);
2683 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2685 goto exit_result_ok;
2691bool INPLACE_OPERATION_ADD_FLOAT_CFLOAT(PyObject **operand1,
double operand2) {
2692 return _INPLACE_OPERATION_ADD_FLOAT_CFLOAT(operand1, operand2);
2695#if PYTHON_VERSION < 0x300
2697static inline bool _INPLACE_OPERATION_ADD_STR_STR(PyObject **operand1, PyObject *operand2) {
2700 CHECK_OBJECT(*operand1);
2701 assert(PyString_CheckExact(*operand1));
2702 CHECK_OBJECT(operand2);
2703 assert(PyString_CheckExact(operand2));
2705 if (Py_REFCNT(*operand1) == 1) {
2708#if PYTHON_VERSION < 0x300
2709 if (1 && !PyString_CHECK_INTERNED(*operand1) && 1) {
2710 return STRING_ADD_INPLACE(operand1, operand2);
2715#if PYTHON_VERSION < 0x300
2718 PyString_Concat(operand1, operand2);
2721 PyThreadState *tstate = PyThreadState_GET();
2723 return !HAS_ERROR_OCCURRED(tstate);
2728 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2730 PyObject *x = PyString_Type.tp_as_sequence->sq_concat(*operand1, operand2);
2731 assert(x != Py_NotImplemented);
2734 goto exit_result_object;
2737 if (unlikely(obj_result == NULL)) {
2738 goto exit_result_exception;
2741 Py_DECREF(*operand1);
2743 *operand1 = obj_result;
2744 goto exit_result_ok;
2749exit_result_exception:
2753bool INPLACE_OPERATION_ADD_STR_STR(PyObject **operand1, PyObject *operand2) {
2754 return _INPLACE_OPERATION_ADD_STR_STR(operand1, operand2);
2758#if PYTHON_VERSION < 0x300
2760static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_OBJECT_STR(PyObject **operand1, PyObject *operand2) {
2761 PyTypeObject *type1 = Py_TYPE(*operand1);
2763#if defined(_MSC_VER)
2764#pragma warning(push)
2765#pragma warning(disable : 4101)
2767 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2768 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2769#if defined(_MSC_VER)
2774 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_add : NULL;
2776 if (islot != NULL) {
2777 PyObject *x = islot(*operand1, operand2);
2779 if (x != Py_NotImplemented) {
2781 goto exit_inplace_result_object;
2784 Py_DECREF_IMMORTAL(x);
2789 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
2791 if (slot1 != NULL) {
2792 PyObject *x = slot1(*operand1, operand2);
2794 if (x != Py_NotImplemented) {
2796 goto exit_inplace_result_object;
2799 Py_DECREF_IMMORTAL(x);
2802#if PYTHON_VERSION < 0x300
2803 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
2805 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
2808 PyObject *coerced1 = *operand1;
2809 PyObject *coerced2 = operand2;
2811 int err = c1(&coerced1, &coerced2);
2813 if (unlikely(err < 0)) {
2814 goto exit_inplace_exception;
2818 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2820 if (likely(mv == NULL)) {
2821 binaryfunc slot = mv->nb_add;
2823 if (likely(slot != NULL)) {
2824 PyObject *x = slot(coerced1, coerced2);
2826 Py_DECREF(coerced1);
2827 Py_DECREF(coerced2);
2830 goto exit_inplace_result_object;
2835 Py_DECREF(coerced1);
2836 Py_DECREF(coerced2);
2844 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_concat : NULL;
2845 if (sq_slot == NULL) {
2846 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
2849 if (sq_slot != NULL) {
2850 PyObject *result = sq_slot(*operand1, operand2);
2852 obj_result = result;
2853 goto exit_inplace_result_object;
2857 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: '%s' and 'str'", type1->tp_name);
2858 goto exit_inplace_exception;
2861exit_inplace_result_object:
2862 if (unlikely(obj_result == NULL)) {
2867 Py_DECREF(*operand1);
2871 *operand1 = obj_result;
2875exit_inplace_exception:
2878static inline bool _INPLACE_OPERATION_ADD_OBJECT_STR(PyObject **operand1, PyObject *operand2) {
2881 CHECK_OBJECT(*operand1);
2882 CHECK_OBJECT(operand2);
2883 assert(PyString_CheckExact(operand2));
2885 if (Py_REFCNT(*operand1) == 1) {
2888#if PYTHON_VERSION < 0x300
2889 if (PyString_CheckExact(*operand1) && !PyString_CHECK_INTERNED(*operand1) && 1) {
2890 return STRING_ADD_INPLACE(operand1, operand2);
2895 PyTypeObject *type1 = Py_TYPE(*operand1);
2897 if (type1 == &PyString_Type) {
2901 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2903 PyObject *x = PyString_Type.tp_as_sequence->sq_concat(*operand1, operand2);
2904 assert(x != Py_NotImplemented);
2907 goto exit_result_object;
2910 if (unlikely(obj_result == NULL)) {
2911 goto exit_result_exception;
2914 Py_DECREF(*operand1);
2916 *operand1 = obj_result;
2917 goto exit_result_ok;
2922 exit_result_exception:
2926 return __INPLACE_OPERATION_ADD_OBJECT_STR(operand1, operand2);
2929bool INPLACE_OPERATION_ADD_OBJECT_STR(PyObject **operand1, PyObject *operand2) {
2930 return _INPLACE_OPERATION_ADD_OBJECT_STR(operand1, operand2);
2934#if PYTHON_VERSION < 0x300
2936static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_STR_OBJECT(PyObject **operand1, PyObject *operand2) {
2937 PyTypeObject *type2 = Py_TYPE(operand2);
2939#if defined(_MSC_VER)
2940#pragma warning(push)
2941#pragma warning(disable : 4101)
2943 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2944 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2945#if defined(_MSC_VER)
2952 binaryfunc slot2 = NULL;
2954 if (!(&PyString_Type == type2)) {
2957 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
2960 if (slot2 != NULL) {
2961 PyObject *x = slot2(*operand1, operand2);
2963 if (x != Py_NotImplemented) {
2965 goto exit_inplace_result_object;
2968 Py_DECREF_IMMORTAL(x);
2971#if PYTHON_VERSION < 0x300
2972 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
2974 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2977 PyObject *coerced1 = *operand1;
2978 PyObject *coerced2 = operand2;
2980 int err = c2(&coerced2, &coerced1);
2982 if (unlikely(err < 0)) {
2983 goto exit_inplace_exception;
2987 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2989 if (likely(mv == NULL)) {
2990 binaryfunc slot = mv->nb_add;
2992 if (likely(slot != NULL)) {
2993 PyObject *x = slot(coerced1, coerced2);
2995 Py_DECREF(coerced1);
2996 Py_DECREF(coerced2);
2999 goto exit_inplace_result_object;
3004 Py_DECREF(coerced1);
3005 Py_DECREF(coerced2);
3012 PyObject *o = PyString_Type.tp_as_sequence->sq_concat(*operand1, operand2);
3014 goto exit_inplace_result_object;
3017 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
3020exit_inplace_result_object:
3021 if (unlikely(obj_result == NULL)) {
3026 Py_DECREF(*operand1);
3030 *operand1 = obj_result;
3034#if PYTHON_VERSION < 0x300
3035exit_inplace_exception:
3039static inline bool _INPLACE_OPERATION_ADD_STR_OBJECT(PyObject **operand1, PyObject *operand2) {
3042 CHECK_OBJECT(*operand1);
3043 assert(PyString_CheckExact(*operand1));
3044 CHECK_OBJECT(operand2);
3046 if (Py_REFCNT(*operand1) == 1) {
3049#if PYTHON_VERSION < 0x300
3050 if (1 && !PyString_CHECK_INTERNED(*operand1) && PyString_CheckExact(operand2)) {
3051 return STRING_ADD_INPLACE(operand1, operand2);
3056 PyTypeObject *type2 = Py_TYPE(operand2);
3058 if (&PyString_Type == type2) {
3062 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3064 PyObject *x = PyString_Type.tp_as_sequence->sq_concat(*operand1, operand2);
3065 assert(x != Py_NotImplemented);
3068 goto exit_result_object;
3071 if (unlikely(obj_result == NULL)) {
3072 goto exit_result_exception;
3075 Py_DECREF(*operand1);
3077 *operand1 = obj_result;
3078 goto exit_result_ok;
3083 exit_result_exception:
3087 return __INPLACE_OPERATION_ADD_STR_OBJECT(operand1, operand2);
3090bool INPLACE_OPERATION_ADD_STR_OBJECT(PyObject **operand1, PyObject *operand2) {
3091 return _INPLACE_OPERATION_ADD_STR_OBJECT(operand1, operand2);
3097static inline bool _INPLACE_OPERATION_ADD_UNICODE_UNICODE(PyObject **operand1, PyObject *operand2) {
3100 CHECK_OBJECT(*operand1);
3101 assert(PyUnicode_CheckExact(*operand1));
3102 CHECK_OBJECT(operand2);
3103 assert(PyUnicode_CheckExact(operand2));
3105 if (Py_REFCNT(*operand1) == 1) {
3109#if PYTHON_VERSION >= 0x300
3110 if (1 && !PyUnicode_CHECK_INTERNED(*operand1) && 1) {
3112 PyThreadState *tstate = PyThreadState_GET();
3114 return UNICODE_ADD_INCREMENTAL(tstate, operand1, operand2);
3120 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3123 PyThreadState *tstate = PyThreadState_GET();
3125 PyObject *x = UNICODE_CONCAT(tstate, *operand1, operand2);
3128 goto exit_result_object;
3131 if (unlikely(obj_result == NULL)) {
3132 goto exit_result_exception;
3135 Py_DECREF(*operand1);
3137 *operand1 = obj_result;
3138 goto exit_result_ok;
3143exit_result_exception:
3147bool INPLACE_OPERATION_ADD_UNICODE_UNICODE(PyObject **operand1, PyObject *operand2) {
3148 return _INPLACE_OPERATION_ADD_UNICODE_UNICODE(operand1, operand2);
3152static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_OBJECT_UNICODE(PyObject **operand1, PyObject *operand2) {
3153 PyTypeObject *type1 = Py_TYPE(*operand1);
3155#if defined(_MSC_VER)
3156#pragma warning(push)
3157#pragma warning(disable : 4101)
3159 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3160 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3161#if defined(_MSC_VER)
3166 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_add : NULL;
3168 if (islot != NULL) {
3169 PyObject *x = islot(*operand1, operand2);
3171 if (x != Py_NotImplemented) {
3173 goto exit_inplace_result_object;
3176 Py_DECREF_IMMORTAL(x);
3181 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
3183 if (slot1 != NULL) {
3184 PyObject *x = slot1(*operand1, operand2);
3186 if (x != Py_NotImplemented) {
3188 goto exit_inplace_result_object;
3191 Py_DECREF_IMMORTAL(x);
3194#if PYTHON_VERSION < 0x300
3195 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
3197 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
3200 PyObject *coerced1 = *operand1;
3201 PyObject *coerced2 = operand2;
3203 int err = c1(&coerced1, &coerced2);
3205 if (unlikely(err < 0)) {
3206 goto exit_inplace_exception;
3210 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
3212 if (likely(mv == NULL)) {
3213 binaryfunc slot = mv->nb_add;
3215 if (likely(slot != NULL)) {
3216 PyObject *x = slot(coerced1, coerced2);
3218 Py_DECREF(coerced1);
3219 Py_DECREF(coerced2);
3222 goto exit_inplace_result_object;
3227 Py_DECREF(coerced1);
3228 Py_DECREF(coerced2);
3236 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_concat : NULL;
3237 if (sq_slot == NULL) {
3238 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
3241 if (sq_slot != NULL) {
3242 PyObject *result = sq_slot(*operand1, operand2);
3244 obj_result = result;
3245 goto exit_inplace_result_object;
3249#if PYTHON_VERSION < 0x300
3250 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: '%s' and 'unicode'", type1->tp_name);
3252 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: '%s' and 'str'", type1->tp_name);
3254 goto exit_inplace_exception;
3257exit_inplace_result_object:
3258 if (unlikely(obj_result == NULL)) {
3263 Py_DECREF(*operand1);
3267 *operand1 = obj_result;
3271exit_inplace_exception:
3274static inline bool _INPLACE_OPERATION_ADD_OBJECT_UNICODE(PyObject **operand1, PyObject *operand2) {
3277 CHECK_OBJECT(*operand1);
3278 CHECK_OBJECT(operand2);
3279 assert(PyUnicode_CheckExact(operand2));
3281 if (Py_REFCNT(*operand1) == 1) {
3285#if PYTHON_VERSION >= 0x300
3286 if (PyUnicode_CheckExact(*operand1) && !PyUnicode_CHECK_INTERNED(*operand1) && 1) {
3288 PyThreadState *tstate = PyThreadState_GET();
3290 return UNICODE_ADD_INCREMENTAL(tstate, operand1, operand2);
3295 PyTypeObject *type1 = Py_TYPE(*operand1);
3297 if (type1 == &PyUnicode_Type) {
3301 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3304 PyThreadState *tstate = PyThreadState_GET();
3306 PyObject *x = UNICODE_CONCAT(tstate, *operand1, operand2);
3309 goto exit_result_object;
3312 if (unlikely(obj_result == NULL)) {
3313 goto exit_result_exception;
3316 Py_DECREF(*operand1);
3318 *operand1 = obj_result;
3319 goto exit_result_ok;
3324 exit_result_exception:
3328 return __INPLACE_OPERATION_ADD_OBJECT_UNICODE(operand1, operand2);
3331bool INPLACE_OPERATION_ADD_OBJECT_UNICODE(PyObject **operand1, PyObject *operand2) {
3332 return _INPLACE_OPERATION_ADD_OBJECT_UNICODE(operand1, operand2);
3336static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_UNICODE_OBJECT(PyObject **operand1, PyObject *operand2) {
3337 PyTypeObject *type2 = Py_TYPE(operand2);
3339#if defined(_MSC_VER)
3340#pragma warning(push)
3341#pragma warning(disable : 4101)
3343 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3344 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3345#if defined(_MSC_VER)
3352 binaryfunc slot2 = NULL;
3354 if (!(&PyUnicode_Type == type2)) {
3357 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
3360 if (slot2 != NULL) {
3361 PyObject *x = slot2(*operand1, operand2);
3363 if (x != Py_NotImplemented) {
3365 goto exit_inplace_result_object;
3368 Py_DECREF_IMMORTAL(x);
3371#if PYTHON_VERSION < 0x300
3372 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
3374 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
3377 PyObject *coerced1 = *operand1;
3378 PyObject *coerced2 = operand2;
3380 int err = c2(&coerced2, &coerced1);
3382 if (unlikely(err < 0)) {
3383 goto exit_inplace_exception;
3387 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
3389 if (likely(mv == NULL)) {
3390 binaryfunc slot = mv->nb_add;
3392 if (likely(slot != NULL)) {
3393 PyObject *x = slot(coerced1, coerced2);
3395 Py_DECREF(coerced1);
3396 Py_DECREF(coerced2);
3399 goto exit_inplace_result_object;
3404 Py_DECREF(coerced1);
3405 Py_DECREF(coerced2);
3412 PyObject *o = PyUnicode_Type.tp_as_sequence->sq_concat(*operand1, operand2);
3414 goto exit_inplace_result_object;
3417 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
3420exit_inplace_result_object:
3421 if (unlikely(obj_result == NULL)) {
3426 Py_DECREF(*operand1);
3430 *operand1 = obj_result;
3434#if PYTHON_VERSION < 0x300
3435exit_inplace_exception:
3439static inline bool _INPLACE_OPERATION_ADD_UNICODE_OBJECT(PyObject **operand1, PyObject *operand2) {
3442 CHECK_OBJECT(*operand1);
3443 assert(PyUnicode_CheckExact(*operand1));
3444 CHECK_OBJECT(operand2);
3446 if (Py_REFCNT(*operand1) == 1) {
3450#if PYTHON_VERSION >= 0x300
3451 if (1 && !PyUnicode_CHECK_INTERNED(*operand1) && PyUnicode_CheckExact(operand2)) {
3453 PyThreadState *tstate = PyThreadState_GET();
3455 return UNICODE_ADD_INCREMENTAL(tstate, operand1, operand2);
3460 PyTypeObject *type2 = Py_TYPE(operand2);
3462 if (&PyUnicode_Type == type2) {
3466 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3469 PyThreadState *tstate = PyThreadState_GET();
3471 PyObject *x = UNICODE_CONCAT(tstate, *operand1, operand2);
3474 goto exit_result_object;
3477 if (unlikely(obj_result == NULL)) {
3478 goto exit_result_exception;
3481 Py_DECREF(*operand1);
3483 *operand1 = obj_result;
3484 goto exit_result_ok;
3489 exit_result_exception:
3493 return __INPLACE_OPERATION_ADD_UNICODE_OBJECT(operand1, operand2);
3496bool INPLACE_OPERATION_ADD_UNICODE_OBJECT(PyObject **operand1, PyObject *operand2) {
3497 return _INPLACE_OPERATION_ADD_UNICODE_OBJECT(operand1, operand2);
3500#if PYTHON_VERSION >= 0x300
3502static inline bool _INPLACE_OPERATION_ADD_BYTES_BYTES(PyObject **operand1, PyObject *operand2) {
3505 CHECK_OBJECT(*operand1);
3506 assert(PyBytes_CheckExact(*operand1));
3507 CHECK_OBJECT(operand2);
3508 assert(PyBytes_CheckExact(operand2));
3510 if (Py_REFCNT(*operand1) == 1) {
3514#if PYTHON_VERSION >= 0x300
3516 return BYTES_ADD_INCREMENTAL(operand1, operand2);
3522 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3524 PyObject *x = PyBytes_Type.tp_as_sequence->sq_concat(*operand1, operand2);
3525 assert(x != Py_NotImplemented);
3528 goto exit_result_object;
3531 if (unlikely(obj_result == NULL)) {
3532 goto exit_result_exception;
3535 Py_DECREF(*operand1);
3537 *operand1 = obj_result;
3538 goto exit_result_ok;
3543exit_result_exception:
3547bool INPLACE_OPERATION_ADD_BYTES_BYTES(PyObject **operand1, PyObject *operand2) {
3548 return _INPLACE_OPERATION_ADD_BYTES_BYTES(operand1, operand2);
3552#if PYTHON_VERSION >= 0x300
3554static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_OBJECT_BYTES(PyObject **operand1, PyObject *operand2) {
3555 PyTypeObject *type1 = Py_TYPE(*operand1);
3557#if defined(_MSC_VER)
3558#pragma warning(push)
3559#pragma warning(disable : 4101)
3561 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3562 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3563#if defined(_MSC_VER)
3568 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_add : NULL;
3570 if (islot != NULL) {
3571 PyObject *x = islot(*operand1, operand2);
3573 if (x != Py_NotImplemented) {
3575 goto exit_inplace_result_object;
3578 Py_DECREF_IMMORTAL(x);
3583 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
3585 if (slot1 != NULL) {
3586 PyObject *x = slot1(*operand1, operand2);
3588 if (x != Py_NotImplemented) {
3590 goto exit_inplace_result_object;
3593 Py_DECREF_IMMORTAL(x);
3596#if PYTHON_VERSION < 0x300
3597 if (!NEW_STYLE_NUMBER_TYPE(type1) || !0) {
3599 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
3602 PyObject *coerced1 = *operand1;
3603 PyObject *coerced2 = operand2;
3605 int err = c1(&coerced1, &coerced2);
3607 if (unlikely(err < 0)) {
3608 goto exit_inplace_exception;
3612 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
3614 if (likely(mv == NULL)) {
3615 binaryfunc slot = mv->nb_add;
3617 if (likely(slot != NULL)) {
3618 PyObject *x = slot(coerced1, coerced2);
3620 Py_DECREF(coerced1);
3621 Py_DECREF(coerced2);
3624 goto exit_inplace_result_object;
3629 Py_DECREF(coerced1);
3630 Py_DECREF(coerced2);
3638 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_concat : NULL;
3639 if (sq_slot == NULL) {
3640 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
3643 if (sq_slot != NULL) {
3644 PyObject *result = sq_slot(*operand1, operand2);
3646 obj_result = result;
3647 goto exit_inplace_result_object;
3651 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: '%s' and 'bytes'", type1->tp_name);
3652 goto exit_inplace_exception;
3655exit_inplace_result_object:
3656 if (unlikely(obj_result == NULL)) {
3661 Py_DECREF(*operand1);
3665 *operand1 = obj_result;
3669exit_inplace_exception:
3672static inline bool _INPLACE_OPERATION_ADD_OBJECT_BYTES(PyObject **operand1, PyObject *operand2) {
3675 CHECK_OBJECT(*operand1);
3676 CHECK_OBJECT(operand2);
3677 assert(PyBytes_CheckExact(operand2));
3679 if (Py_REFCNT(*operand1) == 1) {
3683#if PYTHON_VERSION >= 0x300
3684 if (PyBytes_CheckExact(*operand1) && 1) {
3685 return BYTES_ADD_INCREMENTAL(operand1, operand2);
3690 PyTypeObject *type1 = Py_TYPE(*operand1);
3692 if (type1 == &PyBytes_Type) {
3696 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3698 PyObject *x = PyBytes_Type.tp_as_sequence->sq_concat(*operand1, operand2);
3699 assert(x != Py_NotImplemented);
3702 goto exit_result_object;
3705 if (unlikely(obj_result == NULL)) {
3706 goto exit_result_exception;
3709 Py_DECREF(*operand1);
3711 *operand1 = obj_result;
3712 goto exit_result_ok;
3717 exit_result_exception:
3721 return __INPLACE_OPERATION_ADD_OBJECT_BYTES(operand1, operand2);
3724bool INPLACE_OPERATION_ADD_OBJECT_BYTES(PyObject **operand1, PyObject *operand2) {
3725 return _INPLACE_OPERATION_ADD_OBJECT_BYTES(operand1, operand2);
3729#if PYTHON_VERSION >= 0x300
3731static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_BYTES_OBJECT(PyObject **operand1, PyObject *operand2) {
3732 PyTypeObject *type2 = Py_TYPE(operand2);
3734#if defined(_MSC_VER)
3735#pragma warning(push)
3736#pragma warning(disable : 4101)
3738 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3739 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3740#if defined(_MSC_VER)
3747 binaryfunc slot2 = NULL;
3749 if (!(&PyBytes_Type == type2)) {
3752 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
3755 if (slot2 != NULL) {
3756 PyObject *x = slot2(*operand1, operand2);
3758 if (x != Py_NotImplemented) {
3760 goto exit_inplace_result_object;
3763 Py_DECREF_IMMORTAL(x);
3766#if PYTHON_VERSION < 0x300
3767 if (!0 || !NEW_STYLE_NUMBER_TYPE(type2)) {
3769 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
3772 PyObject *coerced1 = *operand1;
3773 PyObject *coerced2 = operand2;
3775 int err = c2(&coerced2, &coerced1);
3777 if (unlikely(err < 0)) {
3778 goto exit_inplace_exception;
3782 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
3784 if (likely(mv == NULL)) {
3785 binaryfunc slot = mv->nb_add;
3787 if (likely(slot != NULL)) {
3788 PyObject *x = slot(coerced1, coerced2);
3790 Py_DECREF(coerced1);
3791 Py_DECREF(coerced2);
3794 goto exit_inplace_result_object;
3799 Py_DECREF(coerced1);
3800 Py_DECREF(coerced2);
3807 PyObject *o = PyBytes_Type.tp_as_sequence->sq_concat(*operand1, operand2);
3809 goto exit_inplace_result_object;
3812 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
3815exit_inplace_result_object:
3816 if (unlikely(obj_result == NULL)) {
3821 Py_DECREF(*operand1);
3825 *operand1 = obj_result;
3829#if PYTHON_VERSION < 0x300
3830exit_inplace_exception:
3834static inline bool _INPLACE_OPERATION_ADD_BYTES_OBJECT(PyObject **operand1, PyObject *operand2) {
3837 CHECK_OBJECT(*operand1);
3838 assert(PyBytes_CheckExact(*operand1));
3839 CHECK_OBJECT(operand2);
3841 if (Py_REFCNT(*operand1) == 1) {
3845#if PYTHON_VERSION >= 0x300
3846 if (1 && PyBytes_CheckExact(operand2)) {
3847 return BYTES_ADD_INCREMENTAL(operand1, operand2);
3852 PyTypeObject *type2 = Py_TYPE(operand2);
3854 if (&PyBytes_Type == type2) {
3858 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3860 PyObject *x = PyBytes_Type.tp_as_sequence->sq_concat(*operand1, operand2);
3861 assert(x != Py_NotImplemented);
3864 goto exit_result_object;
3867 if (unlikely(obj_result == NULL)) {
3868 goto exit_result_exception;
3871 Py_DECREF(*operand1);
3873 *operand1 = obj_result;
3874 goto exit_result_ok;
3879 exit_result_exception:
3883 return __INPLACE_OPERATION_ADD_BYTES_OBJECT(operand1, operand2);
3886bool INPLACE_OPERATION_ADD_BYTES_OBJECT(PyObject **operand1, PyObject *operand2) {
3887 return _INPLACE_OPERATION_ADD_BYTES_OBJECT(operand1, operand2);
3892static inline bool _INPLACE_OPERATION_ADD_TUPLE_TUPLE(PyObject **operand1, PyObject *operand2) {
3895 CHECK_OBJECT(*operand1);
3896 assert(PyTuple_CheckExact(*operand1));
3897 CHECK_OBJECT(operand2);
3898 assert(PyTuple_CheckExact(operand2));
3901 PyObject *result = PySequence_InPlaceConcat(*operand1, operand2);
3903 if (unlikely(result == NULL)) {
3907 Py_DECREF(*operand1);
3914 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3917 PyThreadState *tstate = PyThreadState_GET();
3919 PyObject *x = TUPLE_CONCAT(tstate, *operand1, operand2);
3921 assert(x != Py_NotImplemented);
3923 goto exit_result_object;
3926 if (unlikely(obj_result == NULL)) {
3927 goto exit_result_exception;
3930 Py_DECREF(*operand1);
3932 *operand1 = obj_result;
3933 goto exit_result_ok;
3938exit_result_exception:
3942bool INPLACE_OPERATION_ADD_TUPLE_TUPLE(PyObject **operand1, PyObject *operand2) {
3943 return _INPLACE_OPERATION_ADD_TUPLE_TUPLE(operand1, operand2);
3947static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_OBJECT_TUPLE(PyObject **operand1, PyObject *operand2) {
3948 PyTypeObject *type1 = Py_TYPE(*operand1);
3950#if defined(_MSC_VER)
3951#pragma warning(push)
3952#pragma warning(disable : 4101)
3954 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3955 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3956#if defined(_MSC_VER)
3961 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_add : NULL;
3963 if (islot != NULL) {
3964 PyObject *x = islot(*operand1, operand2);
3966 if (x != Py_NotImplemented) {
3968 goto exit_inplace_result_object;
3971 Py_DECREF_IMMORTAL(x);
3976 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
3978 if (slot1 != NULL) {
3979 PyObject *x = slot1(*operand1, operand2);
3981 if (x != Py_NotImplemented) {
3983 goto exit_inplace_result_object;
3986 Py_DECREF_IMMORTAL(x);
3989#if PYTHON_VERSION < 0x300
3990 if (!NEW_STYLE_NUMBER_TYPE(type1) || !0) {
3992 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
3995 PyObject *coerced1 = *operand1;
3996 PyObject *coerced2 = operand2;
3998 int err = c1(&coerced1, &coerced2);
4000 if (unlikely(err < 0)) {
4001 goto exit_inplace_exception;
4005 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4007 if (likely(mv == NULL)) {
4008 binaryfunc slot = mv->nb_add;
4010 if (likely(slot != NULL)) {
4011 PyObject *x = slot(coerced1, coerced2);
4013 Py_DECREF(coerced1);
4014 Py_DECREF(coerced2);
4017 goto exit_inplace_result_object;
4022 Py_DECREF(coerced1);
4023 Py_DECREF(coerced2);
4031 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_concat : NULL;
4032 if (sq_slot == NULL) {
4033 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
4036 if (sq_slot != NULL) {
4037 PyObject *result = sq_slot(*operand1, operand2);
4039 obj_result = result;
4040 goto exit_inplace_result_object;
4044 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: '%s' and 'tuple'", type1->tp_name);
4045 goto exit_inplace_exception;
4048exit_inplace_result_object:
4049 if (unlikely(obj_result == NULL)) {
4054 Py_DECREF(*operand1);
4058 *operand1 = obj_result;
4062exit_inplace_exception:
4065static inline bool _INPLACE_OPERATION_ADD_OBJECT_TUPLE(PyObject **operand1, PyObject *operand2) {
4068 CHECK_OBJECT(*operand1);
4069 CHECK_OBJECT(operand2);
4070 assert(PyTuple_CheckExact(operand2));
4072 PyTypeObject *type1 = Py_TYPE(*operand1);
4074 if (type1 == &PyTuple_Type) {
4078 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4081 PyThreadState *tstate = PyThreadState_GET();
4083 PyObject *x = TUPLE_CONCAT(tstate, *operand1, operand2);
4085 assert(x != Py_NotImplemented);
4087 goto exit_result_object;
4090 if (unlikely(obj_result == NULL)) {
4091 goto exit_result_exception;
4094 Py_DECREF(*operand1);
4096 *operand1 = obj_result;
4097 goto exit_result_ok;
4102 exit_result_exception:
4106 return __INPLACE_OPERATION_ADD_OBJECT_TUPLE(operand1, operand2);
4109bool INPLACE_OPERATION_ADD_OBJECT_TUPLE(PyObject **operand1, PyObject *operand2) {
4110 return _INPLACE_OPERATION_ADD_OBJECT_TUPLE(operand1, operand2);
4114static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_TUPLE_OBJECT(PyObject **operand1, PyObject *operand2) {
4115 PyTypeObject *type2 = Py_TYPE(operand2);
4117#if defined(_MSC_VER)
4118#pragma warning(push)
4119#pragma warning(disable : 4101)
4121 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4122 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4123#if defined(_MSC_VER)
4130 binaryfunc slot2 = NULL;
4132 if (!(&PyTuple_Type == type2)) {
4135 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
4138 if (slot2 != NULL) {
4139 PyObject *x = slot2(*operand1, operand2);
4141 if (x != Py_NotImplemented) {
4143 goto exit_inplace_result_object;
4146 Py_DECREF_IMMORTAL(x);
4149#if PYTHON_VERSION < 0x300
4150 if (!0 || !NEW_STYLE_NUMBER_TYPE(type2)) {
4152 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4155 PyObject *coerced1 = *operand1;
4156 PyObject *coerced2 = operand2;
4158 int err = c2(&coerced2, &coerced1);
4160 if (unlikely(err < 0)) {
4161 goto exit_inplace_exception;
4165 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4167 if (likely(mv == NULL)) {
4168 binaryfunc slot = mv->nb_add;
4170 if (likely(slot != NULL)) {
4171 PyObject *x = slot(coerced1, coerced2);
4173 Py_DECREF(coerced1);
4174 Py_DECREF(coerced2);
4177 goto exit_inplace_result_object;
4182 Py_DECREF(coerced1);
4183 Py_DECREF(coerced2);
4190 PyObject *o = PyTuple_Type.tp_as_sequence->sq_concat(*operand1, operand2);
4192 goto exit_inplace_result_object;
4195 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
4198exit_inplace_result_object:
4199 if (unlikely(obj_result == NULL)) {
4204 Py_DECREF(*operand1);
4208 *operand1 = obj_result;
4212#if PYTHON_VERSION < 0x300
4213exit_inplace_exception:
4217static inline bool _INPLACE_OPERATION_ADD_TUPLE_OBJECT(PyObject **operand1, PyObject *operand2) {
4220 CHECK_OBJECT(*operand1);
4221 assert(PyTuple_CheckExact(*operand1));
4222 CHECK_OBJECT(operand2);
4224 if (1 && (PyTuple_CheckExact(operand2) || PySequence_Check(operand2))) {
4225 PyObject *result = PySequence_InPlaceConcat(*operand1, operand2);
4227 if (unlikely(result == NULL)) {
4231 Py_DECREF(*operand1);
4237 PyTypeObject *type2 = Py_TYPE(operand2);
4239 if (&PyTuple_Type == type2) {
4243 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4246 PyThreadState *tstate = PyThreadState_GET();
4248 PyObject *x = TUPLE_CONCAT(tstate, *operand1, operand2);
4250 assert(x != Py_NotImplemented);
4252 goto exit_result_object;
4255 if (unlikely(obj_result == NULL)) {
4256 goto exit_result_exception;
4259 Py_DECREF(*operand1);
4261 *operand1 = obj_result;
4262 goto exit_result_ok;
4267 exit_result_exception:
4271 return __INPLACE_OPERATION_ADD_TUPLE_OBJECT(operand1, operand2);
4274bool INPLACE_OPERATION_ADD_TUPLE_OBJECT(PyObject **operand1, PyObject *operand2) {
4275 return _INPLACE_OPERATION_ADD_TUPLE_OBJECT(operand1, operand2);
4279static inline bool _INPLACE_OPERATION_ADD_LIST_LIST(PyObject **operand1, PyObject *operand2) {
4282 CHECK_OBJECT(*operand1);
4283 assert(PyList_CheckExact(*operand1));
4284 CHECK_OBJECT(operand2);
4285 assert(PyList_CheckExact(operand2));
4288 return LIST_EXTEND_FROM_LIST(*operand1, operand2);
4292 PyObject *result = PySequence_InPlaceConcat(*operand1, operand2);
4294 if (unlikely(result == NULL)) {
4298 Py_DECREF(*operand1);
4305 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4308 PyThreadState *tstate = PyThreadState_GET();
4310 PyObject *x = LIST_CONCAT(tstate, *operand1, operand2);
4311 assert(x != Py_NotImplemented);
4314 goto exit_result_object;
4317 if (unlikely(obj_result == NULL)) {
4318 goto exit_result_exception;
4322 Py_DECREF(*operand1);
4324 *operand1 = obj_result;
4325 goto exit_result_ok;
4330exit_result_exception:
4334bool INPLACE_OPERATION_ADD_LIST_LIST(PyObject **operand1, PyObject *operand2) {
4335 return _INPLACE_OPERATION_ADD_LIST_LIST(operand1, operand2);
4339static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_OBJECT_LIST(PyObject **operand1, PyObject *operand2) {
4340 PyTypeObject *type1 = Py_TYPE(*operand1);
4342#if defined(_MSC_VER)
4343#pragma warning(push)
4344#pragma warning(disable : 4101)
4346 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4347 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4348#if defined(_MSC_VER)
4353 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_add : NULL;
4355 if (islot != NULL) {
4356 PyObject *x = islot(*operand1, operand2);
4358 if (x != Py_NotImplemented) {
4360 goto exit_inplace_result_object;
4363 Py_DECREF_IMMORTAL(x);
4368 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
4370 if (slot1 != NULL) {
4371 PyObject *x = slot1(*operand1, operand2);
4373 if (x != Py_NotImplemented) {
4375 goto exit_inplace_result_object;
4378 Py_DECREF_IMMORTAL(x);
4381#if PYTHON_VERSION < 0x300
4382 if (!NEW_STYLE_NUMBER_TYPE(type1) || !0) {
4384 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
4387 PyObject *coerced1 = *operand1;
4388 PyObject *coerced2 = operand2;
4390 int err = c1(&coerced1, &coerced2);
4392 if (unlikely(err < 0)) {
4393 goto exit_inplace_exception;
4397 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4399 if (likely(mv == NULL)) {
4400 binaryfunc slot = mv->nb_add;
4402 if (likely(slot != NULL)) {
4403 PyObject *x = slot(coerced1, coerced2);
4405 Py_DECREF(coerced1);
4406 Py_DECREF(coerced2);
4409 goto exit_inplace_result_object;
4414 Py_DECREF(coerced1);
4415 Py_DECREF(coerced2);
4423 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_concat : NULL;
4424 if (sq_slot == NULL) {
4425 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
4428 if (sq_slot != NULL) {
4429 PyObject *result = sq_slot(*operand1, operand2);
4431 obj_result = result;
4432 goto exit_inplace_result_object;
4436 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: '%s' and 'list'", type1->tp_name);
4437 goto exit_inplace_exception;
4440exit_inplace_result_object:
4441 if (unlikely(obj_result == NULL)) {
4446 Py_DECREF(*operand1);
4450 *operand1 = obj_result;
4454exit_inplace_exception:
4457static inline bool _INPLACE_OPERATION_ADD_OBJECT_LIST(PyObject **operand1, PyObject *operand2) {
4460 CHECK_OBJECT(*operand1);
4461 CHECK_OBJECT(operand2);
4462 assert(PyList_CheckExact(operand2));
4464 if (PyList_CheckExact(*operand1) && 1) {
4465 return LIST_EXTEND_FROM_LIST(*operand1, operand2);
4468 PyTypeObject *type1 = Py_TYPE(*operand1);
4470 if (type1 == &PyList_Type) {
4474 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4477 PyThreadState *tstate = PyThreadState_GET();
4479 PyObject *x = LIST_CONCAT(tstate, *operand1, operand2);
4480 assert(x != Py_NotImplemented);
4483 goto exit_result_object;
4486 if (unlikely(obj_result == NULL)) {
4487 goto exit_result_exception;
4491 Py_DECREF(*operand1);
4493 *operand1 = obj_result;
4494 goto exit_result_ok;
4499 exit_result_exception:
4503 return __INPLACE_OPERATION_ADD_OBJECT_LIST(operand1, operand2);
4506bool INPLACE_OPERATION_ADD_OBJECT_LIST(PyObject **operand1, PyObject *operand2) {
4507 return _INPLACE_OPERATION_ADD_OBJECT_LIST(operand1, operand2);
4511static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_ADD_LIST_OBJECT(PyObject **operand1, PyObject *operand2) {
4512 PyTypeObject *type2 = Py_TYPE(operand2);
4514#if defined(_MSC_VER)
4515#pragma warning(push)
4516#pragma warning(disable : 4101)
4518 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4519 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4520#if defined(_MSC_VER)
4527 binaryfunc slot2 = NULL;
4529 if (!(&PyList_Type == type2)) {
4532 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
4535 if (slot2 != NULL) {
4536 PyObject *x = slot2(*operand1, operand2);
4538 if (x != Py_NotImplemented) {
4540 goto exit_inplace_result_object;
4543 Py_DECREF_IMMORTAL(x);
4546#if PYTHON_VERSION < 0x300
4547 if (!0 || !NEW_STYLE_NUMBER_TYPE(type2)) {
4549 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4552 PyObject *coerced1 = *operand1;
4553 PyObject *coerced2 = operand2;
4555 int err = c2(&coerced2, &coerced1);
4557 if (unlikely(err < 0)) {
4558 goto exit_inplace_exception;
4562 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4564 if (likely(mv == NULL)) {
4565 binaryfunc slot = mv->nb_add;
4567 if (likely(slot != NULL)) {
4568 PyObject *x = slot(coerced1, coerced2);
4570 Py_DECREF(coerced1);
4571 Py_DECREF(coerced2);
4574 goto exit_inplace_result_object;
4579 Py_DECREF(coerced1);
4580 Py_DECREF(coerced2);
4587 PyObject *o = PyList_Type.tp_as_sequence->sq_inplace_concat(*operand1, operand2);
4589 goto exit_inplace_result_object;
4592 PyObject *o = PyList_Type.tp_as_sequence->sq_concat(*operand1, operand2);
4594 goto exit_inplace_result_object;
4597 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
4600exit_inplace_result_object:
4601 if (unlikely(obj_result == NULL)) {
4606 Py_DECREF(*operand1);
4610 *operand1 = obj_result;
4614#if PYTHON_VERSION < 0x300
4615exit_inplace_exception:
4619static inline bool _INPLACE_OPERATION_ADD_LIST_OBJECT(PyObject **operand1, PyObject *operand2) {
4622 CHECK_OBJECT(*operand1);
4623 assert(PyList_CheckExact(*operand1));
4624 CHECK_OBJECT(operand2);
4626 if (1 && PyList_CheckExact(operand2)) {
4627 return LIST_EXTEND_FROM_LIST(*operand1, operand2);
4630 if (1 && PySequence_Check(operand2)) {
4631 PyObject *result = PySequence_InPlaceConcat(*operand1, operand2);
4633 if (unlikely(result == NULL)) {
4637 Py_DECREF(*operand1);
4643 PyTypeObject *type2 = Py_TYPE(operand2);
4645 if (&PyList_Type == type2) {
4649 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4652 PyThreadState *tstate = PyThreadState_GET();
4654 PyObject *x = LIST_CONCAT(tstate, *operand1, operand2);
4655 assert(x != Py_NotImplemented);
4658 goto exit_result_object;
4661 if (unlikely(obj_result == NULL)) {
4662 goto exit_result_exception;
4666 Py_DECREF(*operand1);
4668 *operand1 = obj_result;
4669 goto exit_result_ok;
4674 exit_result_exception:
4678 return __INPLACE_OPERATION_ADD_LIST_OBJECT(operand1, operand2);
4681bool INPLACE_OPERATION_ADD_LIST_OBJECT(PyObject **operand1, PyObject *operand2) {
4682 return _INPLACE_OPERATION_ADD_LIST_OBJECT(operand1, operand2);
4685#if PYTHON_VERSION < 0x300
4687static inline bool _INPLACE_OPERATION_ADD_UNICODE_STR(PyObject **operand1, PyObject *operand2) {
4690 CHECK_OBJECT(*operand1);
4691 assert(PyUnicode_CheckExact(*operand1));
4692 CHECK_OBJECT(operand2);
4693 assert(PyString_CheckExact(operand2));
4695#if defined(_MSC_VER)
4696#pragma warning(push)
4697#pragma warning(disable : 4101)
4699 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4700 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4701#if defined(_MSC_VER)
4712 PyObject *o = PyUnicode_Type.tp_as_sequence->sq_concat(*operand1, operand2);
4714 goto exit_inplace_result_object;
4717 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
4720exit_inplace_result_object:
4721 if (unlikely(obj_result == NULL)) {
4726 Py_DECREF(*operand1);
4730 *operand1 = obj_result;
4735bool INPLACE_OPERATION_ADD_UNICODE_STR(PyObject **operand1, PyObject *operand2) {
4736 return _INPLACE_OPERATION_ADD_UNICODE_STR(operand1, operand2);
4740#if PYTHON_VERSION < 0x300
4742static inline bool _INPLACE_OPERATION_ADD_STR_UNICODE(PyObject **operand1, PyObject *operand2) {
4745 CHECK_OBJECT(*operand1);
4746 assert(PyString_CheckExact(*operand1));
4747 CHECK_OBJECT(operand2);
4748 assert(PyUnicode_CheckExact(operand2));
4750#if defined(_MSC_VER)
4751#pragma warning(push)
4752#pragma warning(disable : 4101)
4754 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4755 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4756#if defined(_MSC_VER)
4767 PyObject *o = PyUnicode_Type.tp_as_sequence->sq_concat(*operand1, operand2);
4769 goto exit_inplace_result_object;
4772 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
4775exit_inplace_result_object:
4776 if (unlikely(obj_result == NULL)) {
4781 Py_DECREF(*operand1);
4785 *operand1 = obj_result;
4790bool INPLACE_OPERATION_ADD_STR_UNICODE(PyObject **operand1, PyObject *operand2) {
4791 return _INPLACE_OPERATION_ADD_STR_UNICODE(operand1, operand2);
4796static inline bool _INPLACE_OPERATION_ADD_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
4799 CHECK_OBJECT(*operand1);
4800 CHECK_OBJECT(operand2);
4802#if PYTHON_VERSION < 0x300
4803 if (PyInt_CheckExact(*operand1) && PyInt_CheckExact(operand2)) {
4806#if defined(_MSC_VER)
4807#pragma warning(push)
4808#pragma warning(disable : 4101)
4810 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4811 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4812 NUITKA_MAY_BE_UNUSED
long clong_result;
4813 NUITKA_MAY_BE_UNUSED
double cfloat_result;
4814#if defined(_MSC_VER)
4818 CHECK_OBJECT(*operand1);
4819 assert(PyInt_CheckExact(*operand1));
4820 CHECK_OBJECT(operand2);
4821 assert(PyInt_CheckExact(operand2));
4823 const long a = PyInt_AS_LONG(*operand1);
4824 const long b = PyInt_AS_LONG(operand2);
4826 const long x = (long)((
unsigned long)a + b);
4827 bool no_overflow = ((x ^ a) >= 0 || (x ^ b) >= 0);
4828 if (likely(no_overflow)) {
4830 goto exit_result_ok_clong;
4834 PyObject *operand1_object = *operand1;
4835 PyObject *operand2_object = operand2;
4837 PyObject *r = PyLong_Type.tp_as_number->nb_add(operand1_object, operand2_object);
4838 assert(r != Py_NotImplemented);
4841 goto exit_result_object;
4844 exit_result_ok_clong:
4847 Py_DECREF(*operand1);
4851 *operand1 = Nuitka_PyInt_FromLong(clong_result);
4852 goto exit_result_ok;
4855 if (unlikely(obj_result == NULL)) {
4856 goto exit_result_exception;
4859 Py_DECREF(*operand1);
4861 *operand1 = obj_result;
4862 goto exit_result_ok;
4867 exit_result_exception:
4872 if (Py_REFCNT(*operand1) == 1) {
4875#if PYTHON_VERSION < 0x300
4876 if (PyString_CheckExact(*operand1) && !PyString_CHECK_INTERNED(*operand1) && PyString_CheckExact(operand2)) {
4877 return STRING_ADD_INPLACE(operand1, operand2);
4881#if PYTHON_VERSION >= 0x300
4882 if (PyUnicode_CheckExact(*operand1) && !PyUnicode_CHECK_INTERNED(*operand1) && PyUnicode_CheckExact(operand2)) {
4884 PyThreadState *tstate = PyThreadState_GET();
4886 return UNICODE_ADD_INCREMENTAL(tstate, operand1, operand2);
4891 if (Py_TYPE(*operand1) == Py_TYPE(operand2)) {
4892 if (PyFloat_CheckExact(operand2)) {
4893 return _INPLACE_OPERATION_ADD_FLOAT_FLOAT(operand1, operand2);
4895#if PYTHON_VERSION >= 0x300
4896 if (PyLong_CheckExact(operand2)) {
4897 return _INPLACE_OPERATION_ADD_LONG_LONG(operand1, operand2);
4902#if PYTHON_VERSION < 0x300
4904 if (PyString_CheckExact(*operand1) && PyString_CheckExact(operand2)) {
4905 PyString_Concat(operand1, operand2);
4908 PyThreadState *tstate = PyThreadState_GET();
4910 return !HAS_ERROR_OCCURRED(tstate);
4913#if PYTHON_VERSION >= 0x300
4915 if (PyUnicode_CheckExact(*operand1) && PyUnicode_CheckExact(operand2)) {
4917 PyThreadState *tstate = PyThreadState_GET();
4919 PyObject *result = UNICODE_CONCAT(tstate, *operand1, operand2);
4921 if (unlikely(result == NULL)) {
4925 Py_DECREF(*operand1);
4932 PyTypeObject *type1 = Py_TYPE(*operand1);
4933 PyTypeObject *type2 = Py_TYPE(operand2);
4935#if defined(_MSC_VER)
4936#pragma warning(push)
4937#pragma warning(disable : 4101)
4939 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4940 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4941#if defined(_MSC_VER)
4946 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_add : NULL;
4948 if (islot != NULL) {
4949 PyObject *x = islot(*operand1, operand2);
4951 if (x != Py_NotImplemented) {
4953 goto exit_inplace_result_object;
4956 Py_DECREF_IMMORTAL(x);
4961 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_add : NULL;
4962 binaryfunc slot2 = NULL;
4964 if (!(type1 == type2)) {
4967 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_add : NULL;
4969 if (slot1 == slot2) {
4974 if (slot1 != NULL) {
4975 if (slot2 != NULL) {
4976 if (Nuitka_Type_IsSubtype(type2, type1)) {
4977 PyObject *x = slot2(*operand1, operand2);
4979 if (x != Py_NotImplemented) {
4981 goto exit_inplace_result_object;
4984 Py_DECREF_IMMORTAL(x);
4989 PyObject *x = slot1(*operand1, operand2);
4991 if (x != Py_NotImplemented) {
4993 goto exit_inplace_result_object;
4996 Py_DECREF_IMMORTAL(x);
4999 if (slot2 != NULL) {
5000 PyObject *x = slot2(*operand1, operand2);
5002 if (x != Py_NotImplemented) {
5004 goto exit_inplace_result_object;
5007 Py_DECREF_IMMORTAL(x);
5010#if PYTHON_VERSION < 0x300
5011 if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
5013 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
5016 PyObject *coerced1 = *operand1;
5017 PyObject *coerced2 = operand2;
5019 int err = c1(&coerced1, &coerced2);
5021 if (unlikely(err < 0)) {
5022 goto exit_inplace_exception;
5026 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
5028 if (likely(mv == NULL)) {
5029 binaryfunc slot = mv->nb_add;
5031 if (likely(slot != NULL)) {
5032 PyObject *x = slot(coerced1, coerced2);
5034 Py_DECREF(coerced1);
5035 Py_DECREF(coerced2);
5038 goto exit_inplace_result_object;
5043 Py_DECREF(coerced1);
5044 Py_DECREF(coerced2);
5048 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
5051 PyObject *coerced1 = *operand1;
5052 PyObject *coerced2 = operand2;
5054 int err = c2(&coerced2, &coerced1);
5056 if (unlikely(err < 0)) {
5057 goto exit_inplace_exception;
5061 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
5063 if (likely(mv == NULL)) {
5064 binaryfunc slot = mv->nb_add;
5066 if (likely(slot != NULL)) {
5067 PyObject *x = slot(coerced1, coerced2);
5069 Py_DECREF(coerced1);
5070 Py_DECREF(coerced2);
5073 goto exit_inplace_result_object;
5078 Py_DECREF(coerced1);
5079 Py_DECREF(coerced2);
5087 binaryfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_concat : NULL;
5088 if (sq_slot == NULL) {
5089 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_concat : NULL;
5092 if (sq_slot != NULL) {
5093 PyObject *result = sq_slot(*operand1, operand2);
5095 obj_result = result;
5096 goto exit_inplace_result_object;
5100 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for +=: '%s' and '%s'", type1->tp_name,
5102 goto exit_inplace_exception;
5105exit_inplace_result_object:
5106 if (unlikely(obj_result == NULL)) {
5111 Py_DECREF(*operand1);
5115 *operand1 = obj_result;
5119exit_inplace_exception:
5123bool INPLACE_OPERATION_ADD_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
5124 return _INPLACE_OPERATION_ADD_OBJECT_OBJECT(operand1, operand2);
5128static inline bool _INPLACE_OPERATION_ADD_LIST_TUPLE(PyObject **operand1, PyObject *operand2) {
5131 CHECK_OBJECT(*operand1);
5132 assert(PyList_CheckExact(*operand1));
5133 CHECK_OBJECT(operand2);
5134 assert(PyTuple_CheckExact(operand2));
5137 PyObject *result = PySequence_InPlaceConcat(*operand1, operand2);
5139 if (unlikely(result == NULL)) {
5143 Py_DECREF(*operand1);
5149#if defined(_MSC_VER)
5150#pragma warning(push)
5151#pragma warning(disable : 4101)
5153 NUITKA_MAY_BE_UNUSED
bool cbool_result;
5154 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
5155#if defined(_MSC_VER)
5166 PyObject *o = PyList_Type.tp_as_sequence->sq_inplace_concat(*operand1, operand2);
5168 goto exit_inplace_result_object;
5171 PyObject *o = PyList_Type.tp_as_sequence->sq_concat(*operand1, operand2);
5173 goto exit_inplace_result_object;
5176 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
5179exit_inplace_result_object:
5180 if (unlikely(obj_result == NULL)) {
5185 Py_DECREF(*operand1);
5189 *operand1 = obj_result;
5194bool INPLACE_OPERATION_ADD_LIST_TUPLE(PyObject **operand1, PyObject *operand2) {
5195 return _INPLACE_OPERATION_ADD_LIST_TUPLE(operand1, operand2);