7#include "nuitka/prelude.h"
12#if PYTHON_VERSION < 0x300
14static inline bool _INPLACE_OPERATION_MULT_INT_INT(PyObject **operand1, PyObject *operand2) {
17 CHECK_OBJECT(*operand1);
18 assert(PyInt_CheckExact(*operand1));
19 CHECK_OBJECT(operand2);
20 assert(PyInt_CheckExact(operand2));
25#pragma warning(disable : 4101)
27 NUITKA_MAY_BE_UNUSED
bool cbool_result;
28 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
29 NUITKA_MAY_BE_UNUSED
long clong_result;
30 NUITKA_MAY_BE_UNUSED
double cfloat_result;
35 CHECK_OBJECT(*operand1);
36 assert(PyInt_CheckExact(*operand1));
37 CHECK_OBJECT(operand2);
38 assert(PyInt_CheckExact(operand2));
40 const long a = PyInt_AS_LONG(*operand1);
41 const long b = PyInt_AS_LONG(operand2);
43 const long longprod = (long)((
unsigned long)a * b);
44 const double doubleprod = (double)a * (
double)b;
45 const double doubled_longprod = (double)longprod;
47 if (likely(doubled_longprod == doubleprod)) {
48 clong_result = longprod;
49 goto exit_result_ok_clong;
51 const double diff = doubled_longprod - doubleprod;
52 const double absdiff = diff >= 0.0 ? diff : -diff;
53 const double absprod = doubleprod >= 0.0 ? doubleprod : -doubleprod;
55 if (likely(32.0 * absdiff <= absprod)) {
56 clong_result = longprod;
57 goto exit_result_ok_clong;
62 PyObject *operand1_object = *operand1;
63 PyObject *operand2_object = operand2;
65 PyObject *r = PyLong_Type.tp_as_number->nb_multiply(operand1_object, operand2_object);
66 assert(r != Py_NotImplemented);
69 goto exit_result_object;
79 *operand1 = Nuitka_PyInt_FromLong(clong_result);
83 if (unlikely(obj_result == NULL)) {
84 goto exit_result_exception;
89 *operand1 = obj_result;
99bool INPLACE_OPERATION_MULT_INT_INT(PyObject **operand1, PyObject *operand2) {
100 return _INPLACE_OPERATION_MULT_INT_INT(operand1, operand2);
104#if PYTHON_VERSION < 0x300
106static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MULT_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
107 PyTypeObject *type1 = Py_TYPE(*operand1);
111#pragma warning(disable : 4101)
113 NUITKA_MAY_BE_UNUSED
bool cbool_result;
114 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
120 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_multiply : NULL;
123 PyObject *x = islot(*operand1, operand2);
125 if (x != Py_NotImplemented) {
127 goto exit_inplace_result_object;
130 Py_DECREF_IMMORTAL(x);
135 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_multiply : NULL;
136 binaryfunc slot2 = NULL;
138 if (!(type1 == &PyInt_Type)) {
141 slot2 = PyInt_Type.tp_as_number->nb_multiply;
143 if (slot1 == slot2) {
149 PyObject *x = slot1(*operand1, operand2);
151 if (x != Py_NotImplemented) {
153 goto exit_inplace_result_object;
156 Py_DECREF_IMMORTAL(x);
160 PyObject *x = slot2(*operand1, operand2);
162 if (x != Py_NotImplemented) {
164 goto exit_inplace_result_object;
167 Py_DECREF_IMMORTAL(x);
170#if PYTHON_VERSION < 0x300
171 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
173 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
176 PyObject *coerced1 = *operand1;
177 PyObject *coerced2 = operand2;
179 int err = c1(&coerced1, &coerced2);
181 if (unlikely(err < 0)) {
182 goto exit_inplace_exception;
186 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
188 if (likely(mv == NULL)) {
189 binaryfunc slot = mv->nb_multiply;
191 if (likely(slot != NULL)) {
192 PyObject *x = slot(coerced1, coerced2);
198 goto exit_inplace_result_object;
207 coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
210 PyObject *coerced1 = *operand1;
211 PyObject *coerced2 = operand2;
213 int err = c2(&coerced2, &coerced1);
215 if (unlikely(err < 0)) {
216 goto exit_inplace_exception;
220 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
222 if (likely(mv == NULL)) {
223 binaryfunc slot = mv->nb_multiply;
225 if (likely(slot != NULL)) {
226 PyObject *x = slot(coerced1, coerced2);
232 goto exit_inplace_result_object;
246 ssizeargfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_repeat : NULL;
247 if (sq_slot == NULL) {
248 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_repeat : NULL;
251 if (sq_slot != NULL) {
252 PyObject *result = SEQUENCE_REPEAT(sq_slot, *operand1, operand2);
255 goto exit_inplace_result_object;
260 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: '%s' and 'int'", type1->tp_name);
261 goto exit_inplace_exception;
264exit_inplace_result_object:
265 if (unlikely(obj_result == NULL)) {
270 Py_DECREF(*operand1);
274 *operand1 = obj_result;
278exit_inplace_exception:
281static inline bool _INPLACE_OPERATION_MULT_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
284 CHECK_OBJECT(*operand1);
285 CHECK_OBJECT(operand2);
286 assert(PyInt_CheckExact(operand2));
288 PyTypeObject *type1 = Py_TYPE(*operand1);
290 if (type1 == &PyInt_Type) {
296#pragma warning(disable : 4101)
298 NUITKA_MAY_BE_UNUSED
bool cbool_result;
299 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
300 NUITKA_MAY_BE_UNUSED
long clong_result;
301 NUITKA_MAY_BE_UNUSED
double cfloat_result;
306 CHECK_OBJECT(*operand1);
307 assert(PyInt_CheckExact(*operand1));
308 CHECK_OBJECT(operand2);
309 assert(PyInt_CheckExact(operand2));
311 const long a = PyInt_AS_LONG(*operand1);
312 const long b = PyInt_AS_LONG(operand2);
314 const long longprod = (long)((
unsigned long)a * b);
315 const double doubleprod = (double)a * (
double)b;
316 const double doubled_longprod = (double)longprod;
318 if (likely(doubled_longprod == doubleprod)) {
319 clong_result = longprod;
320 goto exit_result_ok_clong;
322 const double diff = doubled_longprod - doubleprod;
323 const double absdiff = diff >= 0.0 ? diff : -diff;
324 const double absprod = doubleprod >= 0.0 ? doubleprod : -doubleprod;
326 if (likely(32.0 * absdiff <= absprod)) {
327 clong_result = longprod;
328 goto exit_result_ok_clong;
333 PyObject *operand1_object = *operand1;
334 PyObject *operand2_object = operand2;
336 PyObject *r = PyLong_Type.tp_as_number->nb_multiply(operand1_object, operand2_object);
337 assert(r != Py_NotImplemented);
340 goto exit_result_object;
343 exit_result_ok_clong:
346 Py_DECREF(*operand1);
350 *operand1 = Nuitka_PyInt_FromLong(clong_result);
354 if (unlikely(obj_result == NULL)) {
355 goto exit_result_exception;
358 Py_DECREF(*operand1);
360 *operand1 = obj_result;
366 exit_result_exception:
370 return __INPLACE_OPERATION_MULT_OBJECT_INT(operand1, operand2);
373bool INPLACE_OPERATION_MULT_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
374 return _INPLACE_OPERATION_MULT_OBJECT_INT(operand1, operand2);
378#if PYTHON_VERSION < 0x300
380static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MULT_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
381 PyTypeObject *type2 = Py_TYPE(operand2);
385#pragma warning(disable : 4101)
387 NUITKA_MAY_BE_UNUSED
bool cbool_result;
388 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
396 binaryfunc slot1 = PyInt_Type.tp_as_number->nb_multiply;
397 binaryfunc slot2 = NULL;
399 if (!(&PyInt_Type == type2)) {
403 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_multiply : NULL;
405 if (slot1 == slot2) {
412 if (Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
413 PyObject *x = slot2(*operand1, operand2);
415 if (x != Py_NotImplemented) {
417 goto exit_inplace_result_object;
420 Py_DECREF_IMMORTAL(x);
425 PyObject *x = slot1(*operand1, operand2);
427 if (x != Py_NotImplemented) {
429 goto exit_inplace_result_object;
432 Py_DECREF_IMMORTAL(x);
436 PyObject *x = slot2(*operand1, operand2);
438 if (x != Py_NotImplemented) {
440 goto exit_inplace_result_object;
443 Py_DECREF_IMMORTAL(x);
446#if PYTHON_VERSION < 0x300
447 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
448 coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
451 PyObject *coerced1 = *operand1;
452 PyObject *coerced2 = operand2;
454 int err = c1(&coerced1, &coerced2);
456 if (unlikely(err < 0)) {
457 goto exit_inplace_exception;
461 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
463 if (likely(mv == NULL)) {
464 binaryfunc slot = mv->nb_multiply;
466 if (likely(slot != NULL)) {
467 PyObject *x = slot(coerced1, coerced2);
473 goto exit_inplace_result_object;
483 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
486 PyObject *coerced1 = *operand1;
487 PyObject *coerced2 = operand2;
489 int err = c2(&coerced2, &coerced1);
491 if (unlikely(err < 0)) {
492 goto exit_inplace_exception;
496 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
498 if (likely(mv == NULL)) {
499 binaryfunc slot = mv->nb_multiply;
501 if (likely(slot != NULL)) {
502 PyObject *x = slot(coerced1, coerced2);
508 goto exit_inplace_result_object;
526 ssizeargfunc sq_slot = type2->tp_as_sequence != NULL ? type2->tp_as_sequence->sq_repeat : NULL;
528 if (sq_slot != NULL) {
529 PyObject *result = SEQUENCE_REPEAT(sq_slot, operand2, *operand1);
532 goto exit_inplace_result_object;
536 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and '%s'", type2->tp_name);
537 goto exit_inplace_exception;
540exit_inplace_result_object:
541 if (unlikely(obj_result == NULL)) {
546 Py_DECREF(*operand1);
550 *operand1 = obj_result;
554exit_inplace_exception:
557static inline bool _INPLACE_OPERATION_MULT_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
560 CHECK_OBJECT(*operand1);
561 assert(PyInt_CheckExact(*operand1));
562 CHECK_OBJECT(operand2);
564 PyTypeObject *type2 = Py_TYPE(operand2);
566 if (&PyInt_Type == type2) {
572#pragma warning(disable : 4101)
574 NUITKA_MAY_BE_UNUSED
bool cbool_result;
575 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
576 NUITKA_MAY_BE_UNUSED
long clong_result;
577 NUITKA_MAY_BE_UNUSED
double cfloat_result;
582 CHECK_OBJECT(*operand1);
583 assert(PyInt_CheckExact(*operand1));
584 CHECK_OBJECT(operand2);
585 assert(PyInt_CheckExact(operand2));
587 const long a = PyInt_AS_LONG(*operand1);
588 const long b = PyInt_AS_LONG(operand2);
590 const long longprod = (long)((
unsigned long)a * b);
591 const double doubleprod = (double)a * (
double)b;
592 const double doubled_longprod = (double)longprod;
594 if (likely(doubled_longprod == doubleprod)) {
595 clong_result = longprod;
596 goto exit_result_ok_clong;
598 const double diff = doubled_longprod - doubleprod;
599 const double absdiff = diff >= 0.0 ? diff : -diff;
600 const double absprod = doubleprod >= 0.0 ? doubleprod : -doubleprod;
602 if (likely(32.0 * absdiff <= absprod)) {
603 clong_result = longprod;
604 goto exit_result_ok_clong;
609 PyObject *operand1_object = *operand1;
610 PyObject *operand2_object = operand2;
612 PyObject *r = PyLong_Type.tp_as_number->nb_multiply(operand1_object, operand2_object);
613 assert(r != Py_NotImplemented);
616 goto exit_result_object;
619 exit_result_ok_clong:
622 Py_DECREF(*operand1);
626 *operand1 = Nuitka_PyInt_FromLong(clong_result);
630 if (unlikely(obj_result == NULL)) {
631 goto exit_result_exception;
634 Py_DECREF(*operand1);
636 *operand1 = obj_result;
642 exit_result_exception:
646 return __INPLACE_OPERATION_MULT_INT_OBJECT(operand1, operand2);
649bool INPLACE_OPERATION_MULT_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
650 return _INPLACE_OPERATION_MULT_INT_OBJECT(operand1, operand2);
655static inline bool _INPLACE_OPERATION_MULT_LONG_LONG(PyObject **operand1, PyObject *operand2) {
658 CHECK_OBJECT(*operand1);
659 assert(PyLong_CheckExact(*operand1));
660 CHECK_OBJECT(operand2);
661 assert(PyLong_CheckExact(operand2));
666#pragma warning(disable : 4101)
668 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
669 NUITKA_MAY_BE_UNUSED
long clong_result;
674 PyObject *x = PyLong_Type.tp_as_number->nb_multiply(*operand1, operand2);
675 assert(x != Py_NotImplemented);
678 goto exit_result_object;
681 if (unlikely(obj_result == NULL)) {
682 goto exit_result_exception;
685 Py_DECREF(*operand1);
686 *operand1 = obj_result;
692exit_result_exception:
696bool INPLACE_OPERATION_MULT_LONG_LONG(PyObject **operand1, PyObject *operand2) {
697 return _INPLACE_OPERATION_MULT_LONG_LONG(operand1, operand2);
701static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MULT_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
702 PyTypeObject *type1 = Py_TYPE(*operand1);
706#pragma warning(disable : 4101)
708 NUITKA_MAY_BE_UNUSED
bool cbool_result;
709 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
715 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_multiply : NULL;
718 PyObject *x = islot(*operand1, operand2);
720 if (x != Py_NotImplemented) {
722 goto exit_inplace_result_object;
725 Py_DECREF_IMMORTAL(x);
730 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_multiply : NULL;
731 binaryfunc slot2 = NULL;
733 if (!(type1 == &PyLong_Type)) {
736 slot2 = PyLong_Type.tp_as_number->nb_multiply;
738 if (slot1 == slot2) {
744 PyObject *x = slot1(*operand1, operand2);
746 if (x != Py_NotImplemented) {
748 goto exit_inplace_result_object;
751 Py_DECREF_IMMORTAL(x);
755 PyObject *x = slot2(*operand1, operand2);
757 if (x != Py_NotImplemented) {
759 goto exit_inplace_result_object;
762 Py_DECREF_IMMORTAL(x);
765#if PYTHON_VERSION < 0x300
766 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
768 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
771 PyObject *coerced1 = *operand1;
772 PyObject *coerced2 = operand2;
774 int err = c1(&coerced1, &coerced2);
776 if (unlikely(err < 0)) {
777 goto exit_inplace_exception;
781 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
783 if (likely(mv == NULL)) {
784 binaryfunc slot = mv->nb_multiply;
786 if (likely(slot != NULL)) {
787 PyObject *x = slot(coerced1, coerced2);
793 goto exit_inplace_result_object;
802 coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
805 PyObject *coerced1 = *operand1;
806 PyObject *coerced2 = operand2;
808 int err = c2(&coerced2, &coerced1);
810 if (unlikely(err < 0)) {
811 goto exit_inplace_exception;
815 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
817 if (likely(mv == NULL)) {
818 binaryfunc slot = mv->nb_multiply;
820 if (likely(slot != NULL)) {
821 PyObject *x = slot(coerced1, coerced2);
827 goto exit_inplace_result_object;
841 ssizeargfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_repeat : NULL;
842 if (sq_slot == NULL) {
843 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_repeat : NULL;
846 if (sq_slot != NULL) {
847 PyObject *result = SEQUENCE_REPEAT(sq_slot, *operand1, operand2);
850 goto exit_inplace_result_object;
855#if PYTHON_VERSION < 0x300
856 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: '%s' and 'long'", type1->tp_name);
858 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: '%s' and 'int'", type1->tp_name);
860 goto exit_inplace_exception;
863exit_inplace_result_object:
864 if (unlikely(obj_result == NULL)) {
869 Py_DECREF(*operand1);
873 *operand1 = obj_result;
877exit_inplace_exception:
880static inline bool _INPLACE_OPERATION_MULT_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
883 CHECK_OBJECT(*operand1);
884 CHECK_OBJECT(operand2);
885 assert(PyLong_CheckExact(operand2));
887 PyTypeObject *type1 = Py_TYPE(*operand1);
889 if (type1 == &PyLong_Type) {
895#pragma warning(disable : 4101)
897 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
898 NUITKA_MAY_BE_UNUSED
long clong_result;
903 PyObject *x = PyLong_Type.tp_as_number->nb_multiply(*operand1, operand2);
904 assert(x != Py_NotImplemented);
907 goto exit_result_object;
910 if (unlikely(obj_result == NULL)) {
911 goto exit_result_exception;
914 Py_DECREF(*operand1);
915 *operand1 = obj_result;
921 exit_result_exception:
925 return __INPLACE_OPERATION_MULT_OBJECT_LONG(operand1, operand2);
928bool INPLACE_OPERATION_MULT_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
929 return _INPLACE_OPERATION_MULT_OBJECT_LONG(operand1, operand2);
933static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MULT_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
934 PyTypeObject *type2 = Py_TYPE(operand2);
938#pragma warning(disable : 4101)
940 NUITKA_MAY_BE_UNUSED
bool cbool_result;
941 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
949 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_multiply;
950 binaryfunc slot2 = NULL;
952 if (!(&PyLong_Type == type2)) {
956 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_multiply : NULL;
958 if (slot1 == slot2) {
965 if (Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
966 PyObject *x = slot2(*operand1, operand2);
968 if (x != Py_NotImplemented) {
970 goto exit_inplace_result_object;
973 Py_DECREF_IMMORTAL(x);
978 PyObject *x = slot1(*operand1, operand2);
980 if (x != Py_NotImplemented) {
982 goto exit_inplace_result_object;
985 Py_DECREF_IMMORTAL(x);
989 PyObject *x = slot2(*operand1, operand2);
991 if (x != Py_NotImplemented) {
993 goto exit_inplace_result_object;
996 Py_DECREF_IMMORTAL(x);
999#if PYTHON_VERSION < 0x300
1000 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1001 coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
1004 PyObject *coerced1 = *operand1;
1005 PyObject *coerced2 = operand2;
1007 int err = c1(&coerced1, &coerced2);
1009 if (unlikely(err < 0)) {
1010 goto exit_inplace_exception;
1014 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1016 if (likely(mv == NULL)) {
1017 binaryfunc slot = mv->nb_multiply;
1019 if (likely(slot != NULL)) {
1020 PyObject *x = slot(coerced1, coerced2);
1022 Py_DECREF(coerced1);
1023 Py_DECREF(coerced2);
1026 goto exit_inplace_result_object;
1031 Py_DECREF(coerced1);
1032 Py_DECREF(coerced2);
1036 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1039 PyObject *coerced1 = *operand1;
1040 PyObject *coerced2 = operand2;
1042 int err = c2(&coerced2, &coerced1);
1044 if (unlikely(err < 0)) {
1045 goto exit_inplace_exception;
1049 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1051 if (likely(mv == NULL)) {
1052 binaryfunc slot = mv->nb_multiply;
1054 if (likely(slot != NULL)) {
1055 PyObject *x = slot(coerced1, coerced2);
1057 Py_DECREF(coerced1);
1058 Py_DECREF(coerced2);
1061 goto exit_inplace_result_object;
1066 Py_DECREF(coerced1);
1067 Py_DECREF(coerced2);
1079 ssizeargfunc sq_slot = type2->tp_as_sequence != NULL ? type2->tp_as_sequence->sq_repeat : NULL;
1081 if (sq_slot != NULL) {
1082 PyObject *result = SEQUENCE_REPEAT(sq_slot, operand2, *operand1);
1084 obj_result = result;
1085 goto exit_inplace_result_object;
1089#if PYTHON_VERSION < 0x300
1090 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'long' and '%s'", type2->tp_name);
1092 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and '%s'", type2->tp_name);
1094 goto exit_inplace_exception;
1097exit_inplace_result_object:
1098 if (unlikely(obj_result == NULL)) {
1103 Py_DECREF(*operand1);
1107 *operand1 = obj_result;
1111exit_inplace_exception:
1114static inline bool _INPLACE_OPERATION_MULT_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1117 CHECK_OBJECT(*operand1);
1118 assert(PyLong_CheckExact(*operand1));
1119 CHECK_OBJECT(operand2);
1121 PyTypeObject *type2 = Py_TYPE(operand2);
1123 if (&PyLong_Type == type2) {
1127#if defined(_MSC_VER)
1128#pragma warning(push)
1129#pragma warning(disable : 4101)
1131 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1132 NUITKA_MAY_BE_UNUSED
long clong_result;
1133#if defined(_MSC_VER)
1137 PyObject *x = PyLong_Type.tp_as_number->nb_multiply(*operand1, operand2);
1138 assert(x != Py_NotImplemented);
1141 goto exit_result_object;
1144 if (unlikely(obj_result == NULL)) {
1145 goto exit_result_exception;
1148 Py_DECREF(*operand1);
1149 *operand1 = obj_result;
1150 goto exit_result_ok;
1155 exit_result_exception:
1159 return __INPLACE_OPERATION_MULT_LONG_OBJECT(operand1, operand2);
1162bool INPLACE_OPERATION_MULT_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1163 return _INPLACE_OPERATION_MULT_LONG_OBJECT(operand1, operand2);
1167static inline bool _INPLACE_OPERATION_MULT_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1170 CHECK_OBJECT(*operand1);
1171 assert(PyFloat_CheckExact(*operand1));
1172 CHECK_OBJECT(operand2);
1173 assert(PyFloat_CheckExact(operand2));
1175#if defined(_MSC_VER)
1176#pragma warning(push)
1177#pragma warning(disable : 4101)
1180 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1181 NUITKA_MAY_BE_UNUSED
long clong_result;
1182 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1183#if defined(_MSC_VER)
1187 CHECK_OBJECT(*operand1);
1188 assert(PyFloat_CheckExact(*operand1));
1189 CHECK_OBJECT(operand2);
1190 assert(PyFloat_CheckExact(operand2));
1192 const double a = PyFloat_AS_DOUBLE(*operand1);
1193 const double b = PyFloat_AS_DOUBLE(operand2);
1198 goto exit_result_ok_cfloat;
1200exit_result_ok_cfloat:
1201 if (Py_REFCNT(*operand1) == 1) {
1202 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1205 Py_DECREF(*operand1);
1207 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1209 goto exit_result_ok;
1215bool INPLACE_OPERATION_MULT_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1216 return _INPLACE_OPERATION_MULT_FLOAT_FLOAT(operand1, operand2);
1220static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MULT_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1221 PyTypeObject *type1 = Py_TYPE(*operand1);
1223#if defined(_MSC_VER)
1224#pragma warning(push)
1225#pragma warning(disable : 4101)
1227 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1228 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1229#if defined(_MSC_VER)
1234 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_multiply : NULL;
1236 if (islot != NULL) {
1237 PyObject *x = islot(*operand1, operand2);
1239 if (x != Py_NotImplemented) {
1241 goto exit_inplace_result_object;
1244 Py_DECREF_IMMORTAL(x);
1249 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_multiply : NULL;
1250 binaryfunc slot2 = NULL;
1252 if (!(type1 == &PyFloat_Type)) {
1255 slot2 = PyFloat_Type.tp_as_number->nb_multiply;
1257 if (slot1 == slot2) {
1262 if (slot1 != NULL) {
1263 PyObject *x = slot1(*operand1, operand2);
1265 if (x != Py_NotImplemented) {
1267 goto exit_inplace_result_object;
1270 Py_DECREF_IMMORTAL(x);
1273 if (slot2 != NULL) {
1274 PyObject *x = slot2(*operand1, operand2);
1276 if (x != Py_NotImplemented) {
1278 goto exit_inplace_result_object;
1281 Py_DECREF_IMMORTAL(x);
1284#if PYTHON_VERSION < 0x300
1285 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1287 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1290 PyObject *coerced1 = *operand1;
1291 PyObject *coerced2 = operand2;
1293 int err = c1(&coerced1, &coerced2);
1295 if (unlikely(err < 0)) {
1296 goto exit_inplace_exception;
1300 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1302 if (likely(mv == NULL)) {
1303 binaryfunc slot = mv->nb_multiply;
1305 if (likely(slot != NULL)) {
1306 PyObject *x = slot(coerced1, coerced2);
1308 Py_DECREF(coerced1);
1309 Py_DECREF(coerced2);
1312 goto exit_inplace_result_object;
1317 Py_DECREF(coerced1);
1318 Py_DECREF(coerced2);
1321 coercion c2 = PyFloat_Type.tp_as_number->nb_coerce;
1324 PyObject *coerced1 = *operand1;
1325 PyObject *coerced2 = operand2;
1327 int err = c2(&coerced2, &coerced1);
1329 if (unlikely(err < 0)) {
1330 goto exit_inplace_exception;
1334 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1336 if (likely(mv == NULL)) {
1337 binaryfunc slot = mv->nb_multiply;
1339 if (likely(slot != NULL)) {
1340 PyObject *x = slot(coerced1, coerced2);
1342 Py_DECREF(coerced1);
1343 Py_DECREF(coerced2);
1346 goto exit_inplace_result_object;
1351 Py_DECREF(coerced1);
1352 Py_DECREF(coerced2);
1360 ssizeargfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_repeat : NULL;
1361 if (sq_slot == NULL) {
1362 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_repeat : NULL;
1365 if (sq_slot != NULL) {
1366 PyObject *result = SEQUENCE_REPEAT(sq_slot, *operand1, operand2);
1368 obj_result = result;
1369 goto exit_inplace_result_object;
1374 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: '%s' and 'float'", type1->tp_name);
1375 goto exit_inplace_exception;
1378exit_inplace_result_object:
1379 if (unlikely(obj_result == NULL)) {
1384 Py_DECREF(*operand1);
1388 *operand1 = obj_result;
1392exit_inplace_exception:
1395static inline bool _INPLACE_OPERATION_MULT_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1398 CHECK_OBJECT(*operand1);
1399 CHECK_OBJECT(operand2);
1400 assert(PyFloat_CheckExact(operand2));
1402 PyTypeObject *type1 = Py_TYPE(*operand1);
1404 if (type1 == &PyFloat_Type) {
1407#if defined(_MSC_VER)
1408#pragma warning(push)
1409#pragma warning(disable : 4101)
1412 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1413 NUITKA_MAY_BE_UNUSED
long clong_result;
1414 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1415#if defined(_MSC_VER)
1419 CHECK_OBJECT(*operand1);
1420 assert(PyFloat_CheckExact(*operand1));
1421 CHECK_OBJECT(operand2);
1422 assert(PyFloat_CheckExact(operand2));
1424 const double a = PyFloat_AS_DOUBLE(*operand1);
1425 const double b = PyFloat_AS_DOUBLE(operand2);
1430 goto exit_result_ok_cfloat;
1432 exit_result_ok_cfloat:
1433 if (Py_REFCNT(*operand1) == 1) {
1434 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1437 Py_DECREF(*operand1);
1439 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1441 goto exit_result_ok;
1447 return __INPLACE_OPERATION_MULT_OBJECT_FLOAT(operand1, operand2);
1450bool INPLACE_OPERATION_MULT_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1451 return _INPLACE_OPERATION_MULT_OBJECT_FLOAT(operand1, operand2);
1455static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MULT_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1456 PyTypeObject *type2 = Py_TYPE(operand2);
1458#if defined(_MSC_VER)
1459#pragma warning(push)
1460#pragma warning(disable : 4101)
1462 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1463 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1464#if defined(_MSC_VER)
1471 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_multiply;
1472 binaryfunc slot2 = NULL;
1474 if (!(&PyFloat_Type == type2)) {
1478 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_multiply : NULL;
1480 if (slot1 == slot2) {
1485 if (slot1 != NULL) {
1486 if (slot2 != NULL) {
1487 if (Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
1488 PyObject *x = slot2(*operand1, operand2);
1490 if (x != Py_NotImplemented) {
1492 goto exit_inplace_result_object;
1495 Py_DECREF_IMMORTAL(x);
1500 PyObject *x = slot1(*operand1, operand2);
1502 if (x != Py_NotImplemented) {
1504 goto exit_inplace_result_object;
1507 Py_DECREF_IMMORTAL(x);
1510 if (slot2 != NULL) {
1511 PyObject *x = slot2(*operand1, operand2);
1513 if (x != Py_NotImplemented) {
1515 goto exit_inplace_result_object;
1518 Py_DECREF_IMMORTAL(x);
1521#if PYTHON_VERSION < 0x300
1522 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1523 coercion c1 = PyFloat_Type.tp_as_number->nb_coerce;
1526 PyObject *coerced1 = *operand1;
1527 PyObject *coerced2 = operand2;
1529 int err = c1(&coerced1, &coerced2);
1531 if (unlikely(err < 0)) {
1532 goto exit_inplace_exception;
1536 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1538 if (likely(mv == NULL)) {
1539 binaryfunc slot = mv->nb_multiply;
1541 if (likely(slot != NULL)) {
1542 PyObject *x = slot(coerced1, coerced2);
1544 Py_DECREF(coerced1);
1545 Py_DECREF(coerced2);
1548 goto exit_inplace_result_object;
1553 Py_DECREF(coerced1);
1554 Py_DECREF(coerced2);
1558 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1561 PyObject *coerced1 = *operand1;
1562 PyObject *coerced2 = operand2;
1564 int err = c2(&coerced2, &coerced1);
1566 if (unlikely(err < 0)) {
1567 goto exit_inplace_exception;
1571 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1573 if (likely(mv == NULL)) {
1574 binaryfunc slot = mv->nb_multiply;
1576 if (likely(slot != NULL)) {
1577 PyObject *x = slot(coerced1, coerced2);
1579 Py_DECREF(coerced1);
1580 Py_DECREF(coerced2);
1583 goto exit_inplace_result_object;
1588 Py_DECREF(coerced1);
1589 Py_DECREF(coerced2);
1601 ssizeargfunc sq_slot = type2->tp_as_sequence != NULL ? type2->tp_as_sequence->sq_repeat : NULL;
1603 if (sq_slot != NULL) {
1604 PyObject *result = SEQUENCE_REPEAT(sq_slot, operand2, *operand1);
1606 obj_result = result;
1607 goto exit_inplace_result_object;
1611 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'float' and '%s'", type2->tp_name);
1612 goto exit_inplace_exception;
1615exit_inplace_result_object:
1616 if (unlikely(obj_result == NULL)) {
1621 Py_DECREF(*operand1);
1625 *operand1 = obj_result;
1629exit_inplace_exception:
1632static inline bool _INPLACE_OPERATION_MULT_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1635 CHECK_OBJECT(*operand1);
1636 assert(PyFloat_CheckExact(*operand1));
1637 CHECK_OBJECT(operand2);
1639 PyTypeObject *type2 = Py_TYPE(operand2);
1641 if (&PyFloat_Type == type2) {
1644#if defined(_MSC_VER)
1645#pragma warning(push)
1646#pragma warning(disable : 4101)
1649 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1650 NUITKA_MAY_BE_UNUSED
long clong_result;
1651 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1652#if defined(_MSC_VER)
1656 CHECK_OBJECT(*operand1);
1657 assert(PyFloat_CheckExact(*operand1));
1658 CHECK_OBJECT(operand2);
1659 assert(PyFloat_CheckExact(operand2));
1661 const double a = PyFloat_AS_DOUBLE(*operand1);
1662 const double b = PyFloat_AS_DOUBLE(operand2);
1667 goto exit_result_ok_cfloat;
1669 exit_result_ok_cfloat:
1670 if (Py_REFCNT(*operand1) == 1) {
1671 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1674 Py_DECREF(*operand1);
1676 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1678 goto exit_result_ok;
1684 return __INPLACE_OPERATION_MULT_FLOAT_OBJECT(operand1, operand2);
1687bool INPLACE_OPERATION_MULT_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1688 return _INPLACE_OPERATION_MULT_FLOAT_OBJECT(operand1, operand2);
1692static inline bool _INPLACE_OPERATION_MULT_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1695 CHECK_OBJECT(*operand1);
1696 assert(PyFloat_CheckExact(*operand1));
1697 CHECK_OBJECT(operand2);
1698 assert(PyLong_CheckExact(operand2));
1700#if defined(_MSC_VER)
1701#pragma warning(push)
1702#pragma warning(disable : 4101)
1704 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1705 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1706#if defined(_MSC_VER)
1713 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_multiply;
1716 if (slot1 != NULL) {
1717 PyObject *x = slot1(*operand1, operand2);
1719 if (x != Py_NotImplemented) {
1721 goto exit_inplace_result_object;
1724 Py_DECREF_IMMORTAL(x);
1735#if PYTHON_VERSION < 0x300
1736 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'float' and 'long'");
1738 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'float' and 'int'");
1740 goto exit_inplace_exception;
1743exit_inplace_result_object:
1744 if (unlikely(obj_result == NULL)) {
1749 Py_DECREF(*operand1);
1753 *operand1 = obj_result;
1757exit_inplace_exception:
1761bool INPLACE_OPERATION_MULT_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1762 return _INPLACE_OPERATION_MULT_FLOAT_LONG(operand1, operand2);
1766static inline bool _INPLACE_OPERATION_MULT_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
1769 CHECK_OBJECT(*operand1);
1770 assert(PyLong_CheckExact(*operand1));
1771 CHECK_OBJECT(operand2);
1772 assert(PyFloat_CheckExact(operand2));
1774#if defined(_MSC_VER)
1775#pragma warning(push)
1776#pragma warning(disable : 4101)
1778 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1779 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1780#if defined(_MSC_VER)
1788 binaryfunc slot2 = NULL;
1793 slot2 = PyFloat_Type.tp_as_number->nb_multiply;
1796 if (slot2 != NULL) {
1797 PyObject *x = slot2(*operand1, operand2);
1799 if (x != Py_NotImplemented) {
1801 goto exit_inplace_result_object;
1804 Py_DECREF_IMMORTAL(x);
1815#if PYTHON_VERSION < 0x300
1816 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'long' and 'float'");
1818 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and 'float'");
1820 goto exit_inplace_exception;
1823exit_inplace_result_object:
1824 if (unlikely(obj_result == NULL)) {
1829 Py_DECREF(*operand1);
1833 *operand1 = obj_result;
1837exit_inplace_exception:
1841bool INPLACE_OPERATION_MULT_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
1842 return _INPLACE_OPERATION_MULT_LONG_FLOAT(operand1, operand2);
1845#if PYTHON_VERSION < 0x300
1847static inline bool _INPLACE_OPERATION_MULT_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
1850 CHECK_OBJECT(*operand1);
1851 assert(PyFloat_CheckExact(*operand1));
1852 CHECK_OBJECT(operand2);
1853 assert(PyInt_CheckExact(operand2));
1855#if defined(_MSC_VER)
1856#pragma warning(push)
1857#pragma warning(disable : 4101)
1859 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1860 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1861#if defined(_MSC_VER)
1868 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_multiply;
1871 if (slot1 != NULL) {
1872 PyObject *x = slot1(*operand1, operand2);
1874 if (x != Py_NotImplemented) {
1876 goto exit_inplace_result_object;
1879 Py_DECREF_IMMORTAL(x);
1890 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'float' and 'int'");
1891 goto exit_inplace_exception;
1894exit_inplace_result_object:
1895 if (unlikely(obj_result == NULL)) {
1900 Py_DECREF(*operand1);
1904 *operand1 = obj_result;
1908exit_inplace_exception:
1912bool INPLACE_OPERATION_MULT_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
1913 return _INPLACE_OPERATION_MULT_FLOAT_INT(operand1, operand2);
1917#if PYTHON_VERSION < 0x300
1919static inline bool _INPLACE_OPERATION_MULT_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
1922 CHECK_OBJECT(*operand1);
1923 assert(PyInt_CheckExact(*operand1));
1924 CHECK_OBJECT(operand2);
1925 assert(PyFloat_CheckExact(operand2));
1927#if defined(_MSC_VER)
1928#pragma warning(push)
1929#pragma warning(disable : 4101)
1931 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1932 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1933#if defined(_MSC_VER)
1941 binaryfunc slot2 = NULL;
1946 slot2 = PyFloat_Type.tp_as_number->nb_multiply;
1949 if (slot2 != NULL) {
1950 PyObject *x = slot2(*operand1, operand2);
1952 if (x != Py_NotImplemented) {
1954 goto exit_inplace_result_object;
1957 Py_DECREF_IMMORTAL(x);
1968 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and 'float'");
1969 goto exit_inplace_exception;
1972exit_inplace_result_object:
1973 if (unlikely(obj_result == NULL)) {
1978 Py_DECREF(*operand1);
1982 *operand1 = obj_result;
1986exit_inplace_exception:
1990bool INPLACE_OPERATION_MULT_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
1991 return _INPLACE_OPERATION_MULT_INT_FLOAT(operand1, operand2);
1995#if PYTHON_VERSION < 0x300
1997static inline bool _INPLACE_OPERATION_MULT_LONG_INT(PyObject **operand1, PyObject *operand2) {
2000 CHECK_OBJECT(*operand1);
2001 assert(PyLong_CheckExact(*operand1));
2002 CHECK_OBJECT(operand2);
2003 assert(PyInt_CheckExact(operand2));
2005#if defined(_MSC_VER)
2006#pragma warning(push)
2007#pragma warning(disable : 4101)
2009 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2010 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2011#if defined(_MSC_VER)
2018 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_multiply;
2021 if (slot1 != NULL) {
2022 PyObject *x = slot1(*operand1, operand2);
2024 if (x != Py_NotImplemented) {
2026 goto exit_inplace_result_object;
2029 Py_DECREF_IMMORTAL(x);
2040 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'long' and 'int'");
2041 goto exit_inplace_exception;
2044exit_inplace_result_object:
2045 if (unlikely(obj_result == NULL)) {
2050 Py_DECREF(*operand1);
2054 *operand1 = obj_result;
2058exit_inplace_exception:
2062bool INPLACE_OPERATION_MULT_LONG_INT(PyObject **operand1, PyObject *operand2) {
2063 return _INPLACE_OPERATION_MULT_LONG_INT(operand1, operand2);
2067#if PYTHON_VERSION < 0x300
2069static inline bool _INPLACE_OPERATION_MULT_INT_LONG(PyObject **operand1, PyObject *operand2) {
2072 CHECK_OBJECT(*operand1);
2073 assert(PyInt_CheckExact(*operand1));
2074 CHECK_OBJECT(operand2);
2075 assert(PyLong_CheckExact(operand2));
2077#if defined(_MSC_VER)
2078#pragma warning(push)
2079#pragma warning(disable : 4101)
2081 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2082 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2083#if defined(_MSC_VER)
2091 binaryfunc slot2 = NULL;
2096 slot2 = PyLong_Type.tp_as_number->nb_multiply;
2099 if (slot2 != NULL) {
2100 PyObject *x = slot2(*operand1, operand2);
2102 if (x != Py_NotImplemented) {
2104 goto exit_inplace_result_object;
2107 Py_DECREF_IMMORTAL(x);
2118 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and 'long'");
2119 goto exit_inplace_exception;
2122exit_inplace_result_object:
2123 if (unlikely(obj_result == NULL)) {
2128 Py_DECREF(*operand1);
2132 *operand1 = obj_result;
2136exit_inplace_exception:
2140bool INPLACE_OPERATION_MULT_INT_LONG(PyObject **operand1, PyObject *operand2) {
2141 return _INPLACE_OPERATION_MULT_INT_LONG(operand1, operand2);
2145#if PYTHON_VERSION < 0x300
2147static inline bool _INPLACE_OPERATION_MULT_INT_CLONG(PyObject **operand1,
long operand2) {
2150 CHECK_OBJECT(*operand1);
2151 assert(PyInt_CheckExact(*operand1));
2154#if defined(_MSC_VER)
2155#pragma warning(push)
2156#pragma warning(disable : 4101)
2158 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2159 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2160 NUITKA_MAY_BE_UNUSED
long clong_result;
2161 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2162#if defined(_MSC_VER)
2166 CHECK_OBJECT(*operand1);
2167 assert(PyInt_CheckExact(*operand1));
2169 const long a = PyInt_AS_LONG(*operand1);
2170 const long b = operand2;
2172 const long longprod = (long)((
unsigned long)a * b);
2173 const double doubleprod = (double)a * (
double)b;
2174 const double doubled_longprod = (double)longprod;
2176 if (likely(doubled_longprod == doubleprod)) {
2177 clong_result = longprod;
2178 goto exit_result_ok_clong;
2180 const double diff = doubled_longprod - doubleprod;
2181 const double absdiff = diff >= 0.0 ? diff : -diff;
2182 const double absprod = doubleprod >= 0.0 ? doubleprod : -doubleprod;
2184 if (likely(32.0 * absdiff <= absprod)) {
2185 clong_result = longprod;
2186 goto exit_result_ok_clong;
2191 PyObject *operand1_object = *operand1;
2192 PyObject *operand2_object = Nuitka_PyLong_FromLong(operand2);
2194 PyObject *r = PyLong_Type.tp_as_number->nb_multiply(operand1_object, operand2_object);
2195 assert(r != Py_NotImplemented);
2197 Py_DECREF(operand2_object);
2200 goto exit_result_object;
2203exit_result_ok_clong:
2206 Py_DECREF(*operand1);
2210 *operand1 = Nuitka_PyInt_FromLong(clong_result);
2211 goto exit_result_ok;
2214 if (unlikely(obj_result == NULL)) {
2215 goto exit_result_exception;
2218 Py_DECREF(*operand1);
2220 *operand1 = obj_result;
2221 goto exit_result_ok;
2226exit_result_exception:
2230bool INPLACE_OPERATION_MULT_INT_CLONG(PyObject **operand1,
long operand2) {
2231 return _INPLACE_OPERATION_MULT_INT_CLONG(operand1, operand2);
2236static inline bool _INPLACE_OPERATION_MULT_FLOAT_CFLOAT(PyObject **operand1,
double operand2) {
2239 CHECK_OBJECT(*operand1);
2240 assert(PyFloat_CheckExact(*operand1));
2242#if defined(_MSC_VER)
2243#pragma warning(push)
2244#pragma warning(disable : 4101)
2247 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2248 NUITKA_MAY_BE_UNUSED
long clong_result;
2249 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2250#if defined(_MSC_VER)
2254 CHECK_OBJECT(*operand1);
2255 assert(PyFloat_CheckExact(*operand1));
2257 const double a = PyFloat_AS_DOUBLE(*operand1);
2258 const double b = operand2;
2263 goto exit_result_ok_cfloat;
2265exit_result_ok_cfloat:
2266 if (Py_REFCNT(*operand1) == 1) {
2267 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
2270 Py_DECREF(*operand1);
2272 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2274 goto exit_result_ok;
2280bool INPLACE_OPERATION_MULT_FLOAT_CFLOAT(PyObject **operand1,
double operand2) {
2281 return _INPLACE_OPERATION_MULT_FLOAT_CFLOAT(operand1, operand2);
2284#if PYTHON_VERSION < 0x300
2286static inline bool _INPLACE_OPERATION_MULT_STR_INT(PyObject **operand1, PyObject *operand2) {
2289 CHECK_OBJECT(*operand1);
2290 assert(PyString_CheckExact(*operand1));
2291 CHECK_OBJECT(operand2);
2292 assert(PyInt_CheckExact(operand2));
2294#if defined(_MSC_VER)
2295#pragma warning(push)
2296#pragma warning(disable : 4101)
2298 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2299 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2300#if defined(_MSC_VER)
2312 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
2314 goto exit_inplace_exception;
2318 PyObject *index_value = operand2;
2321 Py_ssize_t count = PyInt_AS_LONG(index_value);
2323 ssizeargfunc repeatfunc = NULL;
2324 if (repeatfunc == NULL) {
2325 repeatfunc = PyString_Type.tp_as_sequence->sq_repeat;
2327 PyObject *r = (*repeatfunc)(*operand1, count);
2330 goto exit_inplace_result_object;
2335 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
2338exit_inplace_result_object:
2339 if (unlikely(obj_result == NULL)) {
2344 Py_DECREF(*operand1);
2348 *operand1 = obj_result;
2352exit_inplace_exception:
2356bool INPLACE_OPERATION_MULT_STR_INT(PyObject **operand1, PyObject *operand2) {
2357 return _INPLACE_OPERATION_MULT_STR_INT(operand1, operand2);
2361#if PYTHON_VERSION < 0x300
2363static inline bool _INPLACE_OPERATION_MULT_INT_STR(PyObject **operand1, PyObject *operand2) {
2366 CHECK_OBJECT(*operand1);
2367 assert(PyInt_CheckExact(*operand1));
2368 CHECK_OBJECT(operand2);
2369 assert(PyString_CheckExact(operand2));
2371#if defined(_MSC_VER)
2372#pragma warning(push)
2373#pragma warning(disable : 4101)
2375 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2376 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2377#if defined(_MSC_VER)
2394 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", *operand1);
2396 goto exit_inplace_exception;
2400 PyObject *index_value = *operand1;
2403 Py_ssize_t count = PyInt_AS_LONG(index_value);
2405 ssizeargfunc repeatfunc = NULL;
2406 if (repeatfunc == NULL) {
2407 repeatfunc = PyString_Type.tp_as_sequence->sq_repeat;
2409 PyObject *r = (*repeatfunc)(operand2, count);
2412 goto exit_inplace_result_object;
2418 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and 'str'");
2419 goto exit_inplace_exception;
2422exit_inplace_result_object:
2423 if (unlikely(obj_result == NULL)) {
2428 Py_DECREF(*operand1);
2432 *operand1 = obj_result;
2436exit_inplace_exception:
2440bool INPLACE_OPERATION_MULT_INT_STR(PyObject **operand1, PyObject *operand2) {
2441 return _INPLACE_OPERATION_MULT_INT_STR(operand1, operand2);
2445#if PYTHON_VERSION < 0x300
2447static inline bool _INPLACE_OPERATION_MULT_UNICODE_INT(PyObject **operand1, PyObject *operand2) {
2450 CHECK_OBJECT(*operand1);
2451 assert(PyUnicode_CheckExact(*operand1));
2452 CHECK_OBJECT(operand2);
2453 assert(PyInt_CheckExact(operand2));
2455#if defined(_MSC_VER)
2456#pragma warning(push)
2457#pragma warning(disable : 4101)
2459 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2460 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2461#if defined(_MSC_VER)
2473 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
2475 goto exit_inplace_exception;
2479 PyObject *index_value = operand2;
2482 Py_ssize_t count = PyInt_AS_LONG(index_value);
2484 ssizeargfunc repeatfunc = NULL;
2485 if (repeatfunc == NULL) {
2486 repeatfunc = PyUnicode_Type.tp_as_sequence->sq_repeat;
2488 PyObject *r = (*repeatfunc)(*operand1, count);
2491 goto exit_inplace_result_object;
2496 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
2499exit_inplace_result_object:
2500 if (unlikely(obj_result == NULL)) {
2505 Py_DECREF(*operand1);
2509 *operand1 = obj_result;
2513exit_inplace_exception:
2517bool INPLACE_OPERATION_MULT_UNICODE_INT(PyObject **operand1, PyObject *operand2) {
2518 return _INPLACE_OPERATION_MULT_UNICODE_INT(operand1, operand2);
2522#if PYTHON_VERSION < 0x300
2524static inline bool _INPLACE_OPERATION_MULT_INT_UNICODE(PyObject **operand1, PyObject *operand2) {
2527 CHECK_OBJECT(*operand1);
2528 assert(PyInt_CheckExact(*operand1));
2529 CHECK_OBJECT(operand2);
2530 assert(PyUnicode_CheckExact(operand2));
2532#if defined(_MSC_VER)
2533#pragma warning(push)
2534#pragma warning(disable : 4101)
2536 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2537 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2538#if defined(_MSC_VER)
2555 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", *operand1);
2557 goto exit_inplace_exception;
2561 PyObject *index_value = *operand1;
2564 Py_ssize_t count = PyInt_AS_LONG(index_value);
2566 ssizeargfunc repeatfunc = NULL;
2567 if (repeatfunc == NULL) {
2568 repeatfunc = PyUnicode_Type.tp_as_sequence->sq_repeat;
2570 PyObject *r = (*repeatfunc)(operand2, count);
2573 goto exit_inplace_result_object;
2579 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and 'unicode'");
2580 goto exit_inplace_exception;
2583exit_inplace_result_object:
2584 if (unlikely(obj_result == NULL)) {
2589 Py_DECREF(*operand1);
2593 *operand1 = obj_result;
2597exit_inplace_exception:
2601bool INPLACE_OPERATION_MULT_INT_UNICODE(PyObject **operand1, PyObject *operand2) {
2602 return _INPLACE_OPERATION_MULT_INT_UNICODE(operand1, operand2);
2606#if PYTHON_VERSION < 0x300
2608static inline bool _INPLACE_OPERATION_MULT_TUPLE_INT(PyObject **operand1, PyObject *operand2) {
2611 CHECK_OBJECT(*operand1);
2612 assert(PyTuple_CheckExact(*operand1));
2613 CHECK_OBJECT(operand2);
2614 assert(PyInt_CheckExact(operand2));
2616#if defined(_MSC_VER)
2617#pragma warning(push)
2618#pragma warning(disable : 4101)
2620 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2621 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2622#if defined(_MSC_VER)
2634 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
2636 goto exit_inplace_exception;
2640 PyObject *index_value = operand2;
2643 Py_ssize_t count = PyInt_AS_LONG(index_value);
2645 ssizeargfunc repeatfunc = NULL;
2646 if (repeatfunc == NULL) {
2647 repeatfunc = PyTuple_Type.tp_as_sequence->sq_repeat;
2649 PyObject *r = (*repeatfunc)(*operand1, count);
2652 goto exit_inplace_result_object;
2657 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
2660exit_inplace_result_object:
2661 if (unlikely(obj_result == NULL)) {
2666 Py_DECREF(*operand1);
2670 *operand1 = obj_result;
2674exit_inplace_exception:
2678bool INPLACE_OPERATION_MULT_TUPLE_INT(PyObject **operand1, PyObject *operand2) {
2679 return _INPLACE_OPERATION_MULT_TUPLE_INT(operand1, operand2);
2683#if PYTHON_VERSION < 0x300
2685static inline bool _INPLACE_OPERATION_MULT_INT_TUPLE(PyObject **operand1, PyObject *operand2) {
2688 CHECK_OBJECT(*operand1);
2689 assert(PyInt_CheckExact(*operand1));
2690 CHECK_OBJECT(operand2);
2691 assert(PyTuple_CheckExact(operand2));
2693#if defined(_MSC_VER)
2694#pragma warning(push)
2695#pragma warning(disable : 4101)
2697 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2698 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2699#if defined(_MSC_VER)
2716 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", *operand1);
2718 goto exit_inplace_exception;
2722 PyObject *index_value = *operand1;
2725 Py_ssize_t count = PyInt_AS_LONG(index_value);
2727 ssizeargfunc repeatfunc = NULL;
2728 if (repeatfunc == NULL) {
2729 repeatfunc = PyTuple_Type.tp_as_sequence->sq_repeat;
2731 PyObject *r = (*repeatfunc)(operand2, count);
2734 goto exit_inplace_result_object;
2740 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and 'tuple'");
2741 goto exit_inplace_exception;
2744exit_inplace_result_object:
2745 if (unlikely(obj_result == NULL)) {
2750 Py_DECREF(*operand1);
2754 *operand1 = obj_result;
2758exit_inplace_exception:
2762bool INPLACE_OPERATION_MULT_INT_TUPLE(PyObject **operand1, PyObject *operand2) {
2763 return _INPLACE_OPERATION_MULT_INT_TUPLE(operand1, operand2);
2767#if PYTHON_VERSION < 0x300
2769static inline bool _INPLACE_OPERATION_MULT_LIST_INT(PyObject **operand1, PyObject *operand2) {
2772 CHECK_OBJECT(*operand1);
2773 assert(PyList_CheckExact(*operand1));
2774 CHECK_OBJECT(operand2);
2775 assert(PyInt_CheckExact(operand2));
2777#if defined(_MSC_VER)
2778#pragma warning(push)
2779#pragma warning(disable : 4101)
2781 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2782 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2783#if defined(_MSC_VER)
2795 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
2797 goto exit_inplace_exception;
2801 PyObject *index_value = operand2;
2804 Py_ssize_t count = PyInt_AS_LONG(index_value);
2806 ssizeargfunc repeatfunc = PyList_Type.tp_as_sequence->sq_inplace_repeat;
2807 if (repeatfunc == NULL) {
2808 repeatfunc = PyList_Type.tp_as_sequence->sq_repeat;
2810 PyObject *r = (*repeatfunc)(*operand1, count);
2813 goto exit_inplace_result_object;
2818 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
2821exit_inplace_result_object:
2822 if (unlikely(obj_result == NULL)) {
2827 Py_DECREF(*operand1);
2831 *operand1 = obj_result;
2835exit_inplace_exception:
2839bool INPLACE_OPERATION_MULT_LIST_INT(PyObject **operand1, PyObject *operand2) {
2840 return _INPLACE_OPERATION_MULT_LIST_INT(operand1, operand2);
2844#if PYTHON_VERSION < 0x300
2846static inline bool _INPLACE_OPERATION_MULT_INT_LIST(PyObject **operand1, PyObject *operand2) {
2849 CHECK_OBJECT(*operand1);
2850 assert(PyInt_CheckExact(*operand1));
2851 CHECK_OBJECT(operand2);
2852 assert(PyList_CheckExact(operand2));
2854#if defined(_MSC_VER)
2855#pragma warning(push)
2856#pragma warning(disable : 4101)
2858 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2859 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2860#if defined(_MSC_VER)
2877 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", *operand1);
2879 goto exit_inplace_exception;
2883 PyObject *index_value = *operand1;
2886 Py_ssize_t count = PyInt_AS_LONG(index_value);
2888 ssizeargfunc repeatfunc = PyList_Type.tp_as_sequence->sq_inplace_repeat;
2889 if (repeatfunc == NULL) {
2890 repeatfunc = PyList_Type.tp_as_sequence->sq_repeat;
2892 PyObject *r = (*repeatfunc)(operand2, count);
2895 goto exit_inplace_result_object;
2901 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and 'list'");
2902 goto exit_inplace_exception;
2905exit_inplace_result_object:
2906 if (unlikely(obj_result == NULL)) {
2911 Py_DECREF(*operand1);
2915 *operand1 = obj_result;
2919exit_inplace_exception:
2923bool INPLACE_OPERATION_MULT_INT_LIST(PyObject **operand1, PyObject *operand2) {
2924 return _INPLACE_OPERATION_MULT_INT_LIST(operand1, operand2);
2930static inline bool _INPLACE_OPERATION_MULT_UNICODE_LONG(PyObject **operand1, PyObject *operand2) {
2933 CHECK_OBJECT(*operand1);
2934 assert(PyUnicode_CheckExact(*operand1));
2935 CHECK_OBJECT(operand2);
2936 assert(PyLong_CheckExact(operand2));
2938#if defined(_MSC_VER)
2939#pragma warning(push)
2940#pragma warning(disable : 4101)
2942 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2943 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2944#if defined(_MSC_VER)
2956 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
2958 goto exit_inplace_exception;
2962 PyObject *index_value = operand2;
2965 Py_ssize_t count = CONVERT_LONG_TO_REPEAT_FACTOR(index_value);
2968 if (unlikely(count == -1)) {
2969#if PYTHON_VERSION < 0x300
2970 PyErr_Format(PyExc_OverflowError,
"cannot fit 'long' into an index-sized integer");
2972 PyErr_Format(PyExc_OverflowError,
"cannot fit 'int' into an index-sized integer");
2974 goto exit_inplace_exception;
2977 ssizeargfunc repeatfunc = NULL;
2978 if (repeatfunc == NULL) {
2979 repeatfunc = PyUnicode_Type.tp_as_sequence->sq_repeat;
2981 PyObject *r = (*repeatfunc)(*operand1, count);
2984 goto exit_inplace_result_object;
2989 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
2992exit_inplace_result_object:
2993 if (unlikely(obj_result == NULL)) {
2998 Py_DECREF(*operand1);
3002 *operand1 = obj_result;
3006exit_inplace_exception:
3010bool INPLACE_OPERATION_MULT_UNICODE_LONG(PyObject **operand1, PyObject *operand2) {
3011 return _INPLACE_OPERATION_MULT_UNICODE_LONG(operand1, operand2);
3016static inline bool _INPLACE_OPERATION_MULT_LONG_UNICODE(PyObject **operand1, PyObject *operand2) {
3019 CHECK_OBJECT(*operand1);
3020 assert(PyLong_CheckExact(*operand1));
3021 CHECK_OBJECT(operand2);
3022 assert(PyUnicode_CheckExact(operand2));
3024#if defined(_MSC_VER)
3025#pragma warning(push)
3026#pragma warning(disable : 4101)
3028 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3029 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3030#if defined(_MSC_VER)
3047 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", *operand1);
3049 goto exit_inplace_exception;
3053 PyObject *index_value = *operand1;
3056 Py_ssize_t count = CONVERT_LONG_TO_REPEAT_FACTOR(index_value);
3059 if (unlikely(count == -1)) {
3060#if PYTHON_VERSION < 0x300
3061 PyErr_Format(PyExc_OverflowError,
"cannot fit 'long' into an index-sized integer");
3063 PyErr_Format(PyExc_OverflowError,
"cannot fit 'int' into an index-sized integer");
3065 goto exit_inplace_exception;
3068 ssizeargfunc repeatfunc = NULL;
3069 if (repeatfunc == NULL) {
3070 repeatfunc = PyUnicode_Type.tp_as_sequence->sq_repeat;
3072 PyObject *r = (*repeatfunc)(operand2, count);
3075 goto exit_inplace_result_object;
3081#if PYTHON_VERSION < 0x300
3082 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'long' and 'unicode'");
3084 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and 'str'");
3086 goto exit_inplace_exception;
3089exit_inplace_result_object:
3090 if (unlikely(obj_result == NULL)) {
3095 Py_DECREF(*operand1);
3099 *operand1 = obj_result;
3103exit_inplace_exception:
3107bool INPLACE_OPERATION_MULT_LONG_UNICODE(PyObject **operand1, PyObject *operand2) {
3108 return _INPLACE_OPERATION_MULT_LONG_UNICODE(operand1, operand2);
3111#if PYTHON_VERSION >= 0x300
3113static inline bool _INPLACE_OPERATION_MULT_BYTES_LONG(PyObject **operand1, PyObject *operand2) {
3116 CHECK_OBJECT(*operand1);
3117 assert(PyBytes_CheckExact(*operand1));
3118 CHECK_OBJECT(operand2);
3119 assert(PyLong_CheckExact(operand2));
3121#if defined(_MSC_VER)
3122#pragma warning(push)
3123#pragma warning(disable : 4101)
3125 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3126 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3127#if defined(_MSC_VER)
3139 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
3141 goto exit_inplace_exception;
3145 PyObject *index_value = operand2;
3148 Py_ssize_t count = CONVERT_LONG_TO_REPEAT_FACTOR(index_value);
3151 if (unlikely(count == -1)) {
3152 PyErr_Format(PyExc_OverflowError,
"cannot fit 'int' into an index-sized integer");
3153 goto exit_inplace_exception;
3156 ssizeargfunc repeatfunc = NULL;
3157 if (repeatfunc == NULL) {
3158 repeatfunc = PyBytes_Type.tp_as_sequence->sq_repeat;
3160 PyObject *r = (*repeatfunc)(*operand1, count);
3163 goto exit_inplace_result_object;
3168 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
3171exit_inplace_result_object:
3172 if (unlikely(obj_result == NULL)) {
3177 Py_DECREF(*operand1);
3181 *operand1 = obj_result;
3185exit_inplace_exception:
3189bool INPLACE_OPERATION_MULT_BYTES_LONG(PyObject **operand1, PyObject *operand2) {
3190 return _INPLACE_OPERATION_MULT_BYTES_LONG(operand1, operand2);
3194#if PYTHON_VERSION >= 0x300
3196static inline bool _INPLACE_OPERATION_MULT_LONG_BYTES(PyObject **operand1, PyObject *operand2) {
3199 CHECK_OBJECT(*operand1);
3200 assert(PyLong_CheckExact(*operand1));
3201 CHECK_OBJECT(operand2);
3202 assert(PyBytes_CheckExact(operand2));
3204#if defined(_MSC_VER)
3205#pragma warning(push)
3206#pragma warning(disable : 4101)
3208 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3209 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3210#if defined(_MSC_VER)
3227 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", *operand1);
3229 goto exit_inplace_exception;
3233 PyObject *index_value = *operand1;
3236 Py_ssize_t count = CONVERT_LONG_TO_REPEAT_FACTOR(index_value);
3239 if (unlikely(count == -1)) {
3240 PyErr_Format(PyExc_OverflowError,
"cannot fit 'int' into an index-sized integer");
3241 goto exit_inplace_exception;
3244 ssizeargfunc repeatfunc = NULL;
3245 if (repeatfunc == NULL) {
3246 repeatfunc = PyBytes_Type.tp_as_sequence->sq_repeat;
3248 PyObject *r = (*repeatfunc)(operand2, count);
3251 goto exit_inplace_result_object;
3257 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and 'bytes'");
3258 goto exit_inplace_exception;
3261exit_inplace_result_object:
3262 if (unlikely(obj_result == NULL)) {
3267 Py_DECREF(*operand1);
3271 *operand1 = obj_result;
3275exit_inplace_exception:
3279bool INPLACE_OPERATION_MULT_LONG_BYTES(PyObject **operand1, PyObject *operand2) {
3280 return _INPLACE_OPERATION_MULT_LONG_BYTES(operand1, operand2);
3285static inline bool _INPLACE_OPERATION_MULT_TUPLE_LONG(PyObject **operand1, PyObject *operand2) {
3288 CHECK_OBJECT(*operand1);
3289 assert(PyTuple_CheckExact(*operand1));
3290 CHECK_OBJECT(operand2);
3291 assert(PyLong_CheckExact(operand2));
3293#if defined(_MSC_VER)
3294#pragma warning(push)
3295#pragma warning(disable : 4101)
3297 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3298 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3299#if defined(_MSC_VER)
3311 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
3313 goto exit_inplace_exception;
3317 PyObject *index_value = operand2;
3320 Py_ssize_t count = CONVERT_LONG_TO_REPEAT_FACTOR(index_value);
3323 if (unlikely(count == -1)) {
3324#if PYTHON_VERSION < 0x300
3325 PyErr_Format(PyExc_OverflowError,
"cannot fit 'long' into an index-sized integer");
3327 PyErr_Format(PyExc_OverflowError,
"cannot fit 'int' into an index-sized integer");
3329 goto exit_inplace_exception;
3332 ssizeargfunc repeatfunc = NULL;
3333 if (repeatfunc == NULL) {
3334 repeatfunc = PyTuple_Type.tp_as_sequence->sq_repeat;
3336 PyObject *r = (*repeatfunc)(*operand1, count);
3339 goto exit_inplace_result_object;
3344 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
3347exit_inplace_result_object:
3348 if (unlikely(obj_result == NULL)) {
3353 Py_DECREF(*operand1);
3357 *operand1 = obj_result;
3361exit_inplace_exception:
3365bool INPLACE_OPERATION_MULT_TUPLE_LONG(PyObject **operand1, PyObject *operand2) {
3366 return _INPLACE_OPERATION_MULT_TUPLE_LONG(operand1, operand2);
3370static inline bool _INPLACE_OPERATION_MULT_LONG_TUPLE(PyObject **operand1, PyObject *operand2) {
3373 CHECK_OBJECT(*operand1);
3374 assert(PyLong_CheckExact(*operand1));
3375 CHECK_OBJECT(operand2);
3376 assert(PyTuple_CheckExact(operand2));
3378#if defined(_MSC_VER)
3379#pragma warning(push)
3380#pragma warning(disable : 4101)
3382 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3383 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3384#if defined(_MSC_VER)
3401 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", *operand1);
3403 goto exit_inplace_exception;
3407 PyObject *index_value = *operand1;
3410 Py_ssize_t count = CONVERT_LONG_TO_REPEAT_FACTOR(index_value);
3413 if (unlikely(count == -1)) {
3414#if PYTHON_VERSION < 0x300
3415 PyErr_Format(PyExc_OverflowError,
"cannot fit 'long' into an index-sized integer");
3417 PyErr_Format(PyExc_OverflowError,
"cannot fit 'int' into an index-sized integer");
3419 goto exit_inplace_exception;
3422 ssizeargfunc repeatfunc = NULL;
3423 if (repeatfunc == NULL) {
3424 repeatfunc = PyTuple_Type.tp_as_sequence->sq_repeat;
3426 PyObject *r = (*repeatfunc)(operand2, count);
3429 goto exit_inplace_result_object;
3435#if PYTHON_VERSION < 0x300
3436 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'long' and 'tuple'");
3438 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and 'tuple'");
3440 goto exit_inplace_exception;
3443exit_inplace_result_object:
3444 if (unlikely(obj_result == NULL)) {
3449 Py_DECREF(*operand1);
3453 *operand1 = obj_result;
3457exit_inplace_exception:
3461bool INPLACE_OPERATION_MULT_LONG_TUPLE(PyObject **operand1, PyObject *operand2) {
3462 return _INPLACE_OPERATION_MULT_LONG_TUPLE(operand1, operand2);
3466static inline bool _INPLACE_OPERATION_MULT_LIST_LONG(PyObject **operand1, PyObject *operand2) {
3469 CHECK_OBJECT(*operand1);
3470 assert(PyList_CheckExact(*operand1));
3471 CHECK_OBJECT(operand2);
3472 assert(PyLong_CheckExact(operand2));
3474#if defined(_MSC_VER)
3475#pragma warning(push)
3476#pragma warning(disable : 4101)
3478 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3479 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3480#if defined(_MSC_VER)
3492 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
3494 goto exit_inplace_exception;
3498 PyObject *index_value = operand2;
3501 Py_ssize_t count = CONVERT_LONG_TO_REPEAT_FACTOR(index_value);
3504 if (unlikely(count == -1)) {
3505#if PYTHON_VERSION < 0x300
3506 PyErr_Format(PyExc_OverflowError,
"cannot fit 'long' into an index-sized integer");
3508 PyErr_Format(PyExc_OverflowError,
"cannot fit 'int' into an index-sized integer");
3510 goto exit_inplace_exception;
3513 ssizeargfunc repeatfunc = PyList_Type.tp_as_sequence->sq_inplace_repeat;
3514 if (repeatfunc == NULL) {
3515 repeatfunc = PyList_Type.tp_as_sequence->sq_repeat;
3517 PyObject *r = (*repeatfunc)(*operand1, count);
3520 goto exit_inplace_result_object;
3525 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
3528exit_inplace_result_object:
3529 if (unlikely(obj_result == NULL)) {
3534 Py_DECREF(*operand1);
3538 *operand1 = obj_result;
3542exit_inplace_exception:
3546bool INPLACE_OPERATION_MULT_LIST_LONG(PyObject **operand1, PyObject *operand2) {
3547 return _INPLACE_OPERATION_MULT_LIST_LONG(operand1, operand2);
3551static inline bool _INPLACE_OPERATION_MULT_LONG_LIST(PyObject **operand1, PyObject *operand2) {
3554 CHECK_OBJECT(*operand1);
3555 assert(PyLong_CheckExact(*operand1));
3556 CHECK_OBJECT(operand2);
3557 assert(PyList_CheckExact(operand2));
3559#if defined(_MSC_VER)
3560#pragma warning(push)
3561#pragma warning(disable : 4101)
3563 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3564 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3565#if defined(_MSC_VER)
3582 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", *operand1);
3584 goto exit_inplace_exception;
3588 PyObject *index_value = *operand1;
3591 Py_ssize_t count = CONVERT_LONG_TO_REPEAT_FACTOR(index_value);
3594 if (unlikely(count == -1)) {
3595#if PYTHON_VERSION < 0x300
3596 PyErr_Format(PyExc_OverflowError,
"cannot fit 'long' into an index-sized integer");
3598 PyErr_Format(PyExc_OverflowError,
"cannot fit 'int' into an index-sized integer");
3600 goto exit_inplace_exception;
3603 ssizeargfunc repeatfunc = PyList_Type.tp_as_sequence->sq_inplace_repeat;
3604 if (repeatfunc == NULL) {
3605 repeatfunc = PyList_Type.tp_as_sequence->sq_repeat;
3607 PyObject *r = (*repeatfunc)(operand2, count);
3610 goto exit_inplace_result_object;
3616#if PYTHON_VERSION < 0x300
3617 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'long' and 'list'");
3619 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: 'int' and 'list'");
3621 goto exit_inplace_exception;
3624exit_inplace_result_object:
3625 if (unlikely(obj_result == NULL)) {
3630 Py_DECREF(*operand1);
3634 *operand1 = obj_result;
3638exit_inplace_exception:
3642bool INPLACE_OPERATION_MULT_LONG_LIST(PyObject **operand1, PyObject *operand2) {
3643 return _INPLACE_OPERATION_MULT_LONG_LIST(operand1, operand2);
3646#if PYTHON_VERSION < 0x300
3648static inline bool _INPLACE_OPERATION_MULT_STR_OBJECT(PyObject **operand1, PyObject *operand2) {
3651 CHECK_OBJECT(*operand1);
3652 assert(PyString_CheckExact(*operand1));
3653 CHECK_OBJECT(operand2);
3655 PyTypeObject *type2 = Py_TYPE(operand2);
3657#if defined(_MSC_VER)
3658#pragma warning(push)
3659#pragma warning(disable : 4101)
3661 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3662 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3663#if defined(_MSC_VER)
3670 binaryfunc slot2 = NULL;
3672 if (!(&PyString_Type == type2)) {
3676 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_multiply : NULL;
3679 if (slot2 != NULL) {
3680 PyObject *x = slot2(*operand1, operand2);
3682 if (x != Py_NotImplemented) {
3684 goto exit_inplace_result_object;
3687 Py_DECREF_IMMORTAL(x);
3690#if PYTHON_VERSION < 0x300
3691 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
3693 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
3696 PyObject *coerced1 = *operand1;
3697 PyObject *coerced2 = operand2;
3699 int err = c2(&coerced2, &coerced1);
3701 if (unlikely(err < 0)) {
3702 goto exit_inplace_exception;
3706 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
3708 if (likely(mv == NULL)) {
3709 binaryfunc slot = mv->nb_multiply;
3711 if (likely(slot != NULL)) {
3712 PyObject *x = slot(coerced1, coerced2);
3714 Py_DECREF(coerced1);
3715 Py_DECREF(coerced2);
3718 goto exit_inplace_result_object;
3723 Py_DECREF(coerced1);
3724 Py_DECREF(coerced2);
3730 if (unlikely(!Nuitka_Index_Check(operand2))) {
3731 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
3733 goto exit_inplace_exception;
3737 PyObject *index_value = Nuitka_Number_Index(operand2);
3739 if (unlikely(index_value == NULL)) {
3740 goto exit_inplace_exception;
3744 Py_ssize_t count = CONVERT_TO_REPEAT_FACTOR(index_value);
3746 Py_DECREF(index_value);
3749 if (unlikely(count == -1)) {
3750 PyErr_Format(PyExc_OverflowError,
"cannot fit '%s' into an index-sized integer", type2->tp_name);
3751 goto exit_inplace_exception;
3754 ssizeargfunc repeatfunc = NULL;
3755 if (repeatfunc == NULL) {
3756 repeatfunc = PyString_Type.tp_as_sequence->sq_repeat;
3758 PyObject *r = (*repeatfunc)(*operand1, count);
3761 goto exit_inplace_result_object;
3766 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
3769exit_inplace_result_object:
3770 if (unlikely(obj_result == NULL)) {
3775 Py_DECREF(*operand1);
3779 *operand1 = obj_result;
3783exit_inplace_exception:
3787bool INPLACE_OPERATION_MULT_STR_OBJECT(PyObject **operand1, PyObject *operand2) {
3788 return _INPLACE_OPERATION_MULT_STR_OBJECT(operand1, operand2);
3793static inline bool _INPLACE_OPERATION_MULT_UNICODE_OBJECT(PyObject **operand1, PyObject *operand2) {
3796 CHECK_OBJECT(*operand1);
3797 assert(PyUnicode_CheckExact(*operand1));
3798 CHECK_OBJECT(operand2);
3800 PyTypeObject *type2 = Py_TYPE(operand2);
3802#if defined(_MSC_VER)
3803#pragma warning(push)
3804#pragma warning(disable : 4101)
3806 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3807 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3808#if defined(_MSC_VER)
3815 binaryfunc slot2 = NULL;
3817 if (!(&PyUnicode_Type == type2)) {
3821 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_multiply : NULL;
3824 if (slot2 != NULL) {
3825 PyObject *x = slot2(*operand1, operand2);
3827 if (x != Py_NotImplemented) {
3829 goto exit_inplace_result_object;
3832 Py_DECREF_IMMORTAL(x);
3835#if PYTHON_VERSION < 0x300
3836 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
3838 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
3841 PyObject *coerced1 = *operand1;
3842 PyObject *coerced2 = operand2;
3844 int err = c2(&coerced2, &coerced1);
3846 if (unlikely(err < 0)) {
3847 goto exit_inplace_exception;
3851 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
3853 if (likely(mv == NULL)) {
3854 binaryfunc slot = mv->nb_multiply;
3856 if (likely(slot != NULL)) {
3857 PyObject *x = slot(coerced1, coerced2);
3859 Py_DECREF(coerced1);
3860 Py_DECREF(coerced2);
3863 goto exit_inplace_result_object;
3868 Py_DECREF(coerced1);
3869 Py_DECREF(coerced2);
3875 if (unlikely(!Nuitka_Index_Check(operand2))) {
3876 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
3878 goto exit_inplace_exception;
3882 PyObject *index_value = Nuitka_Number_Index(operand2);
3884 if (unlikely(index_value == NULL)) {
3885 goto exit_inplace_exception;
3889 Py_ssize_t count = CONVERT_TO_REPEAT_FACTOR(index_value);
3891 Py_DECREF(index_value);
3894 if (unlikely(count == -1)) {
3895 PyErr_Format(PyExc_OverflowError,
"cannot fit '%s' into an index-sized integer", type2->tp_name);
3896 goto exit_inplace_exception;
3899 ssizeargfunc repeatfunc = NULL;
3900 if (repeatfunc == NULL) {
3901 repeatfunc = PyUnicode_Type.tp_as_sequence->sq_repeat;
3903 PyObject *r = (*repeatfunc)(*operand1, count);
3906 goto exit_inplace_result_object;
3911 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
3914exit_inplace_result_object:
3915 if (unlikely(obj_result == NULL)) {
3920 Py_DECREF(*operand1);
3924 *operand1 = obj_result;
3928exit_inplace_exception:
3932bool INPLACE_OPERATION_MULT_UNICODE_OBJECT(PyObject **operand1, PyObject *operand2) {
3933 return _INPLACE_OPERATION_MULT_UNICODE_OBJECT(operand1, operand2);
3936#if PYTHON_VERSION >= 0x300
3938static inline bool _INPLACE_OPERATION_MULT_BYTES_OBJECT(PyObject **operand1, PyObject *operand2) {
3941 CHECK_OBJECT(*operand1);
3942 assert(PyBytes_CheckExact(*operand1));
3943 CHECK_OBJECT(operand2);
3945 PyTypeObject *type2 = Py_TYPE(operand2);
3947#if defined(_MSC_VER)
3948#pragma warning(push)
3949#pragma warning(disable : 4101)
3951 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3952 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3953#if defined(_MSC_VER)
3960 binaryfunc slot2 = NULL;
3962 if (!(&PyBytes_Type == type2)) {
3966 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_multiply : NULL;
3969 if (slot2 != NULL) {
3970 PyObject *x = slot2(*operand1, operand2);
3972 if (x != Py_NotImplemented) {
3974 goto exit_inplace_result_object;
3977 Py_DECREF_IMMORTAL(x);
3980#if PYTHON_VERSION < 0x300
3981 if (!0 || !NEW_STYLE_NUMBER_TYPE(type2)) {
3983 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
3986 PyObject *coerced1 = *operand1;
3987 PyObject *coerced2 = operand2;
3989 int err = c2(&coerced2, &coerced1);
3991 if (unlikely(err < 0)) {
3992 goto exit_inplace_exception;
3996 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
3998 if (likely(mv == NULL)) {
3999 binaryfunc slot = mv->nb_multiply;
4001 if (likely(slot != NULL)) {
4002 PyObject *x = slot(coerced1, coerced2);
4004 Py_DECREF(coerced1);
4005 Py_DECREF(coerced2);
4008 goto exit_inplace_result_object;
4013 Py_DECREF(coerced1);
4014 Py_DECREF(coerced2);
4020 if (unlikely(!Nuitka_Index_Check(operand2))) {
4021 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
4023 goto exit_inplace_exception;
4027 PyObject *index_value = Nuitka_Number_Index(operand2);
4029 if (unlikely(index_value == NULL)) {
4030 goto exit_inplace_exception;
4034 Py_ssize_t count = CONVERT_TO_REPEAT_FACTOR(index_value);
4036 Py_DECREF(index_value);
4039 if (unlikely(count == -1)) {
4040 PyErr_Format(PyExc_OverflowError,
"cannot fit '%s' into an index-sized integer", type2->tp_name);
4041 goto exit_inplace_exception;
4044 ssizeargfunc repeatfunc = NULL;
4045 if (repeatfunc == NULL) {
4046 repeatfunc = PyBytes_Type.tp_as_sequence->sq_repeat;
4048 PyObject *r = (*repeatfunc)(*operand1, count);
4051 goto exit_inplace_result_object;
4056 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
4059exit_inplace_result_object:
4060 if (unlikely(obj_result == NULL)) {
4065 Py_DECREF(*operand1);
4069 *operand1 = obj_result;
4073exit_inplace_exception:
4077bool INPLACE_OPERATION_MULT_BYTES_OBJECT(PyObject **operand1, PyObject *operand2) {
4078 return _INPLACE_OPERATION_MULT_BYTES_OBJECT(operand1, operand2);
4083static inline bool _INPLACE_OPERATION_MULT_TUPLE_OBJECT(PyObject **operand1, PyObject *operand2) {
4086 CHECK_OBJECT(*operand1);
4087 assert(PyTuple_CheckExact(*operand1));
4088 CHECK_OBJECT(operand2);
4090 PyTypeObject *type2 = Py_TYPE(operand2);
4092#if defined(_MSC_VER)
4093#pragma warning(push)
4094#pragma warning(disable : 4101)
4096 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4097 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4098#if defined(_MSC_VER)
4105 binaryfunc slot2 = NULL;
4107 if (!(&PyTuple_Type == type2)) {
4111 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_multiply : NULL;
4114 if (slot2 != NULL) {
4115 PyObject *x = slot2(*operand1, operand2);
4117 if (x != Py_NotImplemented) {
4119 goto exit_inplace_result_object;
4122 Py_DECREF_IMMORTAL(x);
4125#if PYTHON_VERSION < 0x300
4126 if (!0 || !NEW_STYLE_NUMBER_TYPE(type2)) {
4128 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4131 PyObject *coerced1 = *operand1;
4132 PyObject *coerced2 = operand2;
4134 int err = c2(&coerced2, &coerced1);
4136 if (unlikely(err < 0)) {
4137 goto exit_inplace_exception;
4141 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4143 if (likely(mv == NULL)) {
4144 binaryfunc slot = mv->nb_multiply;
4146 if (likely(slot != NULL)) {
4147 PyObject *x = slot(coerced1, coerced2);
4149 Py_DECREF(coerced1);
4150 Py_DECREF(coerced2);
4153 goto exit_inplace_result_object;
4158 Py_DECREF(coerced1);
4159 Py_DECREF(coerced2);
4165 if (unlikely(!Nuitka_Index_Check(operand2))) {
4166 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
4168 goto exit_inplace_exception;
4172 PyObject *index_value = Nuitka_Number_Index(operand2);
4174 if (unlikely(index_value == NULL)) {
4175 goto exit_inplace_exception;
4179 Py_ssize_t count = CONVERT_TO_REPEAT_FACTOR(index_value);
4181 Py_DECREF(index_value);
4184 if (unlikely(count == -1)) {
4185 PyErr_Format(PyExc_OverflowError,
"cannot fit '%s' into an index-sized integer", type2->tp_name);
4186 goto exit_inplace_exception;
4189 ssizeargfunc repeatfunc = NULL;
4190 if (repeatfunc == NULL) {
4191 repeatfunc = PyTuple_Type.tp_as_sequence->sq_repeat;
4193 PyObject *r = (*repeatfunc)(*operand1, count);
4196 goto exit_inplace_result_object;
4201 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
4204exit_inplace_result_object:
4205 if (unlikely(obj_result == NULL)) {
4210 Py_DECREF(*operand1);
4214 *operand1 = obj_result;
4218exit_inplace_exception:
4222bool INPLACE_OPERATION_MULT_TUPLE_OBJECT(PyObject **operand1, PyObject *operand2) {
4223 return _INPLACE_OPERATION_MULT_TUPLE_OBJECT(operand1, operand2);
4227static inline bool _INPLACE_OPERATION_MULT_LIST_OBJECT(PyObject **operand1, PyObject *operand2) {
4230 CHECK_OBJECT(*operand1);
4231 assert(PyList_CheckExact(*operand1));
4232 CHECK_OBJECT(operand2);
4234 PyTypeObject *type2 = Py_TYPE(operand2);
4236#if defined(_MSC_VER)
4237#pragma warning(push)
4238#pragma warning(disable : 4101)
4240 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4241 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4242#if defined(_MSC_VER)
4249 binaryfunc slot2 = NULL;
4251 if (!(&PyList_Type == type2)) {
4255 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_multiply : NULL;
4258 if (slot2 != NULL) {
4259 PyObject *x = slot2(*operand1, operand2);
4261 if (x != Py_NotImplemented) {
4263 goto exit_inplace_result_object;
4266 Py_DECREF_IMMORTAL(x);
4269#if PYTHON_VERSION < 0x300
4270 if (!0 || !NEW_STYLE_NUMBER_TYPE(type2)) {
4272 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4275 PyObject *coerced1 = *operand1;
4276 PyObject *coerced2 = operand2;
4278 int err = c2(&coerced2, &coerced1);
4280 if (unlikely(err < 0)) {
4281 goto exit_inplace_exception;
4285 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4287 if (likely(mv == NULL)) {
4288 binaryfunc slot = mv->nb_multiply;
4290 if (likely(slot != NULL)) {
4291 PyObject *x = slot(coerced1, coerced2);
4293 Py_DECREF(coerced1);
4294 Py_DECREF(coerced2);
4297 goto exit_inplace_result_object;
4302 Py_DECREF(coerced1);
4303 Py_DECREF(coerced2);
4309 if (unlikely(!Nuitka_Index_Check(operand2))) {
4310 SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
"can't multiply sequence by non-int of type '%s'", operand2);
4312 goto exit_inplace_exception;
4316 PyObject *index_value = Nuitka_Number_Index(operand2);
4318 if (unlikely(index_value == NULL)) {
4319 goto exit_inplace_exception;
4323 Py_ssize_t count = CONVERT_TO_REPEAT_FACTOR(index_value);
4325 Py_DECREF(index_value);
4328 if (unlikely(count == -1)) {
4329 PyErr_Format(PyExc_OverflowError,
"cannot fit '%s' into an index-sized integer", type2->tp_name);
4330 goto exit_inplace_exception;
4333 ssizeargfunc repeatfunc = PyList_Type.tp_as_sequence->sq_inplace_repeat;
4334 if (repeatfunc == NULL) {
4335 repeatfunc = PyList_Type.tp_as_sequence->sq_repeat;
4337 PyObject *r = (*repeatfunc)(*operand1, count);
4340 goto exit_inplace_result_object;
4345 NUITKA_CANNOT_GET_HERE(
"missing error exit annotation");
4348exit_inplace_result_object:
4349 if (unlikely(obj_result == NULL)) {
4354 Py_DECREF(*operand1);
4358 *operand1 = obj_result;
4362exit_inplace_exception:
4366bool INPLACE_OPERATION_MULT_LIST_OBJECT(PyObject **operand1, PyObject *operand2) {
4367 return _INPLACE_OPERATION_MULT_LIST_OBJECT(operand1, operand2);
4371static inline bool _INPLACE_OPERATION_MULT_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
4374 CHECK_OBJECT(*operand1);
4375 CHECK_OBJECT(operand2);
4377#if PYTHON_VERSION < 0x300
4378 if (PyInt_CheckExact(*operand1) && PyInt_CheckExact(operand2)) {
4381#if defined(_MSC_VER)
4382#pragma warning(push)
4383#pragma warning(disable : 4101)
4385 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4386 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4387 NUITKA_MAY_BE_UNUSED
long clong_result;
4388 NUITKA_MAY_BE_UNUSED
double cfloat_result;
4389#if defined(_MSC_VER)
4393 CHECK_OBJECT(*operand1);
4394 assert(PyInt_CheckExact(*operand1));
4395 CHECK_OBJECT(operand2);
4396 assert(PyInt_CheckExact(operand2));
4398 const long a = PyInt_AS_LONG(*operand1);
4399 const long b = PyInt_AS_LONG(operand2);
4401 const long longprod = (long)((
unsigned long)a * b);
4402 const double doubleprod = (double)a * (
double)b;
4403 const double doubled_longprod = (double)longprod;
4405 if (likely(doubled_longprod == doubleprod)) {
4406 clong_result = longprod;
4407 goto exit_result_ok_clong;
4409 const double diff = doubled_longprod - doubleprod;
4410 const double absdiff = diff >= 0.0 ? diff : -diff;
4411 const double absprod = doubleprod >= 0.0 ? doubleprod : -doubleprod;
4413 if (likely(32.0 * absdiff <= absprod)) {
4414 clong_result = longprod;
4415 goto exit_result_ok_clong;
4420 PyObject *operand1_object = *operand1;
4421 PyObject *operand2_object = operand2;
4423 PyObject *r = PyLong_Type.tp_as_number->nb_multiply(operand1_object, operand2_object);
4424 assert(r != Py_NotImplemented);
4427 goto exit_result_object;
4430 exit_result_ok_clong:
4433 Py_DECREF(*operand1);
4437 *operand1 = Nuitka_PyInt_FromLong(clong_result);
4438 goto exit_result_ok;
4441 if (unlikely(obj_result == NULL)) {
4442 goto exit_result_exception;
4445 Py_DECREF(*operand1);
4447 *operand1 = obj_result;
4448 goto exit_result_ok;
4453 exit_result_exception:
4458 if (Py_TYPE(*operand1) == Py_TYPE(operand2)) {
4459 if (PyFloat_CheckExact(operand2)) {
4460 return _INPLACE_OPERATION_MULT_FLOAT_FLOAT(operand1, operand2);
4462#if PYTHON_VERSION >= 0x300
4463 if (PyLong_CheckExact(operand2)) {
4464 return _INPLACE_OPERATION_MULT_LONG_LONG(operand1, operand2);
4469 PyTypeObject *type1 = Py_TYPE(*operand1);
4470 PyTypeObject *type2 = Py_TYPE(operand2);
4472#if defined(_MSC_VER)
4473#pragma warning(push)
4474#pragma warning(disable : 4101)
4476 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4477 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4478#if defined(_MSC_VER)
4483 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_multiply : NULL;
4485 if (islot != NULL) {
4486 PyObject *x = islot(*operand1, operand2);
4488 if (x != Py_NotImplemented) {
4490 goto exit_inplace_result_object;
4493 Py_DECREF_IMMORTAL(x);
4498 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_multiply : NULL;
4499 binaryfunc slot2 = NULL;
4501 if (!(type1 == type2)) {
4505 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_multiply : NULL;
4507 if (slot1 == slot2) {
4512 if (slot1 != NULL) {
4513 if (slot2 != NULL) {
4514 if (Nuitka_Type_IsSubtype(type2, type1)) {
4515 PyObject *x = slot2(*operand1, operand2);
4517 if (x != Py_NotImplemented) {
4519 goto exit_inplace_result_object;
4522 Py_DECREF_IMMORTAL(x);
4527 PyObject *x = slot1(*operand1, operand2);
4529 if (x != Py_NotImplemented) {
4531 goto exit_inplace_result_object;
4534 Py_DECREF_IMMORTAL(x);
4537 if (slot2 != NULL) {
4538 PyObject *x = slot2(*operand1, operand2);
4540 if (x != Py_NotImplemented) {
4542 goto exit_inplace_result_object;
4545 Py_DECREF_IMMORTAL(x);
4548#if PYTHON_VERSION < 0x300
4549 if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
4551 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
4554 PyObject *coerced1 = *operand1;
4555 PyObject *coerced2 = operand2;
4557 int err = c1(&coerced1, &coerced2);
4559 if (unlikely(err < 0)) {
4560 goto exit_inplace_exception;
4564 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4566 if (likely(mv == NULL)) {
4567 binaryfunc slot = mv->nb_multiply;
4569 if (likely(slot != NULL)) {
4570 PyObject *x = slot(coerced1, coerced2);
4572 Py_DECREF(coerced1);
4573 Py_DECREF(coerced2);
4576 goto exit_inplace_result_object;
4581 Py_DECREF(coerced1);
4582 Py_DECREF(coerced2);
4586 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4589 PyObject *coerced1 = *operand1;
4590 PyObject *coerced2 = operand2;
4592 int err = c2(&coerced2, &coerced1);
4594 if (unlikely(err < 0)) {
4595 goto exit_inplace_exception;
4599 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4601 if (likely(mv == NULL)) {
4602 binaryfunc slot = mv->nb_multiply;
4604 if (likely(slot != NULL)) {
4605 PyObject *x = slot(coerced1, coerced2);
4607 Py_DECREF(coerced1);
4608 Py_DECREF(coerced2);
4611 goto exit_inplace_result_object;
4616 Py_DECREF(coerced1);
4617 Py_DECREF(coerced2);
4625 ssizeargfunc sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_inplace_repeat : NULL;
4626 if (sq_slot == NULL) {
4627 sq_slot = type1->tp_as_sequence != NULL ? type1->tp_as_sequence->sq_repeat : NULL;
4630 if (sq_slot != NULL) {
4631 PyObject *result = SEQUENCE_REPEAT(sq_slot, *operand1, operand2);
4633 obj_result = result;
4634 goto exit_inplace_result_object;
4638 if (type1->tp_as_sequence == NULL) {
4639 ssizeargfunc sq_slot = type2->tp_as_sequence != NULL ? type2->tp_as_sequence->sq_repeat : NULL;
4641 if (sq_slot != NULL) {
4642 PyObject *result = SEQUENCE_REPEAT(sq_slot, operand2, *operand1);
4644 obj_result = result;
4645 goto exit_inplace_result_object;
4649 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for *=: '%s' and '%s'", type1->tp_name,
4651 goto exit_inplace_exception;
4654exit_inplace_result_object:
4655 if (unlikely(obj_result == NULL)) {
4660 Py_DECREF(*operand1);
4664 *operand1 = obj_result;
4668exit_inplace_exception:
4672bool INPLACE_OPERATION_MULT_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
4673 return _INPLACE_OPERATION_MULT_OBJECT_OBJECT(operand1, operand2);