7#include "nuitka/prelude.h"
12#if PYTHON_VERSION < 0x300
14static inline bool _INPLACE_OPERATION_MOD_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);
49 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
53 if (r != 0 && ((b ^ r) < 0)) {
58 goto exit_result_ok_clong;
62 PyObject *operand1_object = *operand1;
63 PyObject *operand2_object = operand2;
65 PyObject *r = PyLong_Type.tp_as_number->nb_remainder(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_MOD_INT_INT(PyObject **operand1, PyObject *operand2) {
100 return _INPLACE_OPERATION_MOD_INT_INT(operand1, operand2);
104#if PYTHON_VERSION < 0x300
106static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MOD_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;
119 binaryfunc islot = (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1))
120 ? type1->tp_as_number->nb_inplace_remainder
124 PyObject *x = islot(*operand1, operand2);
126 if (x != Py_NotImplemented) {
128 goto exit_inplace_result_object;
131 Py_DECREF_IMMORTAL(x);
136 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_remainder : NULL;
137 binaryfunc slot2 = NULL;
139 if (!(type1 == &PyInt_Type)) {
142 slot2 = PyInt_Type.tp_as_number->nb_remainder;
144 if (slot1 == slot2) {
150 PyObject *x = slot1(*operand1, operand2);
152 if (x != Py_NotImplemented) {
154 goto exit_inplace_result_object;
157 Py_DECREF_IMMORTAL(x);
161 PyObject *x = slot2(*operand1, operand2);
163 if (x != Py_NotImplemented) {
165 goto exit_inplace_result_object;
168 Py_DECREF_IMMORTAL(x);
171#if PYTHON_VERSION < 0x300
172 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
174 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
177 PyObject *coerced1 = *operand1;
178 PyObject *coerced2 = operand2;
180 int err = c1(&coerced1, &coerced2);
182 if (unlikely(err < 0)) {
183 goto exit_inplace_exception;
187 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
189 if (likely(mv == NULL)) {
190 binaryfunc slot = mv->nb_remainder;
192 if (likely(slot != NULL)) {
193 PyObject *x = slot(coerced1, coerced2);
199 goto exit_inplace_result_object;
208 coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
211 PyObject *coerced1 = *operand1;
212 PyObject *coerced2 = operand2;
214 int err = c2(&coerced2, &coerced1);
216 if (unlikely(err < 0)) {
217 goto exit_inplace_exception;
221 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
223 if (likely(mv == NULL)) {
224 binaryfunc slot = mv->nb_remainder;
226 if (likely(slot != NULL)) {
227 PyObject *x = slot(coerced1, coerced2);
233 goto exit_inplace_result_object;
245 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: '%s' and 'int'", type1->tp_name);
246 goto exit_inplace_exception;
249exit_inplace_result_object:
250 if (unlikely(obj_result == NULL)) {
255 Py_DECREF(*operand1);
259 *operand1 = obj_result;
263exit_inplace_exception:
266static inline bool _INPLACE_OPERATION_MOD_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
269 CHECK_OBJECT(*operand1);
270 CHECK_OBJECT(operand2);
271 assert(PyInt_CheckExact(operand2));
273 PyTypeObject *type1 = Py_TYPE(*operand1);
275 if (type1 == &PyInt_Type) {
281#pragma warning(disable : 4101)
283 NUITKA_MAY_BE_UNUSED
bool cbool_result;
284 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
285 NUITKA_MAY_BE_UNUSED
long clong_result;
286 NUITKA_MAY_BE_UNUSED
double cfloat_result;
291 CHECK_OBJECT(*operand1);
292 assert(PyInt_CheckExact(*operand1));
293 CHECK_OBJECT(operand2);
294 assert(PyInt_CheckExact(operand2));
296 const long a = PyInt_AS_LONG(*operand1);
297 const long b = PyInt_AS_LONG(operand2);
305 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
309 if (r != 0 && ((b ^ r) < 0)) {
314 goto exit_result_ok_clong;
318 PyObject *operand1_object = *operand1;
319 PyObject *operand2_object = operand2;
321 PyObject *r = PyLong_Type.tp_as_number->nb_remainder(operand1_object, operand2_object);
322 assert(r != Py_NotImplemented);
325 goto exit_result_object;
328 exit_result_ok_clong:
331 Py_DECREF(*operand1);
335 *operand1 = Nuitka_PyInt_FromLong(clong_result);
339 if (unlikely(obj_result == NULL)) {
340 goto exit_result_exception;
343 Py_DECREF(*operand1);
345 *operand1 = obj_result;
351 exit_result_exception:
355 return __INPLACE_OPERATION_MOD_OBJECT_INT(operand1, operand2);
358bool INPLACE_OPERATION_MOD_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
359 return _INPLACE_OPERATION_MOD_OBJECT_INT(operand1, operand2);
363#if PYTHON_VERSION < 0x300
365static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MOD_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
366 PyTypeObject *type2 = Py_TYPE(operand2);
370#pragma warning(disable : 4101)
372 NUITKA_MAY_BE_UNUSED
bool cbool_result;
373 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
381 binaryfunc slot1 = PyInt_Type.tp_as_number->nb_remainder;
382 binaryfunc slot2 = NULL;
384 if (!(&PyInt_Type == type2)) {
387 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_remainder
390 if (slot1 == slot2) {
397 if (Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
398 PyObject *x = slot2(*operand1, operand2);
400 if (x != Py_NotImplemented) {
402 goto exit_inplace_result_object;
405 Py_DECREF_IMMORTAL(x);
410 PyObject *x = slot1(*operand1, operand2);
412 if (x != Py_NotImplemented) {
414 goto exit_inplace_result_object;
417 Py_DECREF_IMMORTAL(x);
421 PyObject *x = slot2(*operand1, operand2);
423 if (x != Py_NotImplemented) {
425 goto exit_inplace_result_object;
428 Py_DECREF_IMMORTAL(x);
431#if PYTHON_VERSION < 0x300
432 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
433 coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
436 PyObject *coerced1 = *operand1;
437 PyObject *coerced2 = operand2;
439 int err = c1(&coerced1, &coerced2);
441 if (unlikely(err < 0)) {
442 goto exit_inplace_exception;
446 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
448 if (likely(mv == NULL)) {
449 binaryfunc slot = mv->nb_remainder;
451 if (likely(slot != NULL)) {
452 PyObject *x = slot(coerced1, coerced2);
458 goto exit_inplace_result_object;
468 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
471 PyObject *coerced1 = *operand1;
472 PyObject *coerced2 = operand2;
474 int err = c2(&coerced2, &coerced1);
476 if (unlikely(err < 0)) {
477 goto exit_inplace_exception;
481 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
483 if (likely(mv == NULL)) {
484 binaryfunc slot = mv->nb_remainder;
486 if (likely(slot != NULL)) {
487 PyObject *x = slot(coerced1, coerced2);
493 goto exit_inplace_result_object;
505 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'int' and '%s'", type2->tp_name);
506 goto exit_inplace_exception;
509exit_inplace_result_object:
510 if (unlikely(obj_result == NULL)) {
515 Py_DECREF(*operand1);
519 *operand1 = obj_result;
523exit_inplace_exception:
526static inline bool _INPLACE_OPERATION_MOD_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
529 CHECK_OBJECT(*operand1);
530 assert(PyInt_CheckExact(*operand1));
531 CHECK_OBJECT(operand2);
533 PyTypeObject *type2 = Py_TYPE(operand2);
535 if (&PyInt_Type == type2) {
541#pragma warning(disable : 4101)
543 NUITKA_MAY_BE_UNUSED
bool cbool_result;
544 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
545 NUITKA_MAY_BE_UNUSED
long clong_result;
546 NUITKA_MAY_BE_UNUSED
double cfloat_result;
551 CHECK_OBJECT(*operand1);
552 assert(PyInt_CheckExact(*operand1));
553 CHECK_OBJECT(operand2);
554 assert(PyInt_CheckExact(operand2));
556 const long a = PyInt_AS_LONG(*operand1);
557 const long b = PyInt_AS_LONG(operand2);
565 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
569 if (r != 0 && ((b ^ r) < 0)) {
574 goto exit_result_ok_clong;
578 PyObject *operand1_object = *operand1;
579 PyObject *operand2_object = operand2;
581 PyObject *r = PyLong_Type.tp_as_number->nb_remainder(operand1_object, operand2_object);
582 assert(r != Py_NotImplemented);
585 goto exit_result_object;
588 exit_result_ok_clong:
591 Py_DECREF(*operand1);
595 *operand1 = Nuitka_PyInt_FromLong(clong_result);
599 if (unlikely(obj_result == NULL)) {
600 goto exit_result_exception;
603 Py_DECREF(*operand1);
605 *operand1 = obj_result;
611 exit_result_exception:
615 return __INPLACE_OPERATION_MOD_INT_OBJECT(operand1, operand2);
618bool INPLACE_OPERATION_MOD_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
619 return _INPLACE_OPERATION_MOD_INT_OBJECT(operand1, operand2);
624static inline bool _INPLACE_OPERATION_MOD_LONG_LONG(PyObject **operand1, PyObject *operand2) {
627 CHECK_OBJECT(*operand1);
628 assert(PyLong_CheckExact(*operand1));
629 CHECK_OBJECT(operand2);
630 assert(PyLong_CheckExact(operand2));
635#pragma warning(disable : 4101)
637 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
638 NUITKA_MAY_BE_UNUSED
long clong_result;
643 PyObject *x = PyLong_Type.tp_as_number->nb_remainder(*operand1, operand2);
644 assert(x != Py_NotImplemented);
647 goto exit_result_object;
650 if (unlikely(obj_result == NULL)) {
651 goto exit_result_exception;
654 Py_DECREF(*operand1);
655 *operand1 = obj_result;
661exit_result_exception:
665bool INPLACE_OPERATION_MOD_LONG_LONG(PyObject **operand1, PyObject *operand2) {
666 return _INPLACE_OPERATION_MOD_LONG_LONG(operand1, operand2);
670static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MOD_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
671 PyTypeObject *type1 = Py_TYPE(*operand1);
675#pragma warning(disable : 4101)
677 NUITKA_MAY_BE_UNUSED
bool cbool_result;
678 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
683 binaryfunc islot = (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1))
684 ? type1->tp_as_number->nb_inplace_remainder
688 PyObject *x = islot(*operand1, operand2);
690 if (x != Py_NotImplemented) {
692 goto exit_inplace_result_object;
695 Py_DECREF_IMMORTAL(x);
700 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_remainder : NULL;
701 binaryfunc slot2 = NULL;
703 if (!(type1 == &PyLong_Type)) {
706 slot2 = PyLong_Type.tp_as_number->nb_remainder;
708 if (slot1 == slot2) {
714 PyObject *x = slot1(*operand1, operand2);
716 if (x != Py_NotImplemented) {
718 goto exit_inplace_result_object;
721 Py_DECREF_IMMORTAL(x);
725 PyObject *x = slot2(*operand1, operand2);
727 if (x != Py_NotImplemented) {
729 goto exit_inplace_result_object;
732 Py_DECREF_IMMORTAL(x);
735#if PYTHON_VERSION < 0x300
736 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
738 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
741 PyObject *coerced1 = *operand1;
742 PyObject *coerced2 = operand2;
744 int err = c1(&coerced1, &coerced2);
746 if (unlikely(err < 0)) {
747 goto exit_inplace_exception;
751 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
753 if (likely(mv == NULL)) {
754 binaryfunc slot = mv->nb_remainder;
756 if (likely(slot != NULL)) {
757 PyObject *x = slot(coerced1, coerced2);
763 goto exit_inplace_result_object;
772 coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
775 PyObject *coerced1 = *operand1;
776 PyObject *coerced2 = operand2;
778 int err = c2(&coerced2, &coerced1);
780 if (unlikely(err < 0)) {
781 goto exit_inplace_exception;
785 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
787 if (likely(mv == NULL)) {
788 binaryfunc slot = mv->nb_remainder;
790 if (likely(slot != NULL)) {
791 PyObject *x = slot(coerced1, coerced2);
797 goto exit_inplace_result_object;
809#if PYTHON_VERSION < 0x300
810 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: '%s' and 'long'", type1->tp_name);
812 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: '%s' and 'int'", type1->tp_name);
814 goto exit_inplace_exception;
817exit_inplace_result_object:
818 if (unlikely(obj_result == NULL)) {
823 Py_DECREF(*operand1);
827 *operand1 = obj_result;
831exit_inplace_exception:
834static inline bool _INPLACE_OPERATION_MOD_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
837 CHECK_OBJECT(*operand1);
838 CHECK_OBJECT(operand2);
839 assert(PyLong_CheckExact(operand2));
841 PyTypeObject *type1 = Py_TYPE(*operand1);
843 if (type1 == &PyLong_Type) {
849#pragma warning(disable : 4101)
851 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
852 NUITKA_MAY_BE_UNUSED
long clong_result;
857 PyObject *x = PyLong_Type.tp_as_number->nb_remainder(*operand1, operand2);
858 assert(x != Py_NotImplemented);
861 goto exit_result_object;
864 if (unlikely(obj_result == NULL)) {
865 goto exit_result_exception;
868 Py_DECREF(*operand1);
869 *operand1 = obj_result;
875 exit_result_exception:
879 return __INPLACE_OPERATION_MOD_OBJECT_LONG(operand1, operand2);
882bool INPLACE_OPERATION_MOD_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
883 return _INPLACE_OPERATION_MOD_OBJECT_LONG(operand1, operand2);
887static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MOD_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
888 PyTypeObject *type2 = Py_TYPE(operand2);
892#pragma warning(disable : 4101)
894 NUITKA_MAY_BE_UNUSED
bool cbool_result;
895 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
903 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_remainder;
904 binaryfunc slot2 = NULL;
906 if (!(&PyLong_Type == type2)) {
909 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_remainder
912 if (slot1 == slot2) {
919 if (Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
920 PyObject *x = slot2(*operand1, operand2);
922 if (x != Py_NotImplemented) {
924 goto exit_inplace_result_object;
927 Py_DECREF_IMMORTAL(x);
932 PyObject *x = slot1(*operand1, operand2);
934 if (x != Py_NotImplemented) {
936 goto exit_inplace_result_object;
939 Py_DECREF_IMMORTAL(x);
943 PyObject *x = slot2(*operand1, operand2);
945 if (x != Py_NotImplemented) {
947 goto exit_inplace_result_object;
950 Py_DECREF_IMMORTAL(x);
953#if PYTHON_VERSION < 0x300
954 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
955 coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
958 PyObject *coerced1 = *operand1;
959 PyObject *coerced2 = operand2;
961 int err = c1(&coerced1, &coerced2);
963 if (unlikely(err < 0)) {
964 goto exit_inplace_exception;
968 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
970 if (likely(mv == NULL)) {
971 binaryfunc slot = mv->nb_remainder;
973 if (likely(slot != NULL)) {
974 PyObject *x = slot(coerced1, coerced2);
980 goto exit_inplace_result_object;
990 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
993 PyObject *coerced1 = *operand1;
994 PyObject *coerced2 = operand2;
996 int err = c2(&coerced2, &coerced1);
998 if (unlikely(err < 0)) {
999 goto exit_inplace_exception;
1003 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1005 if (likely(mv == NULL)) {
1006 binaryfunc slot = mv->nb_remainder;
1008 if (likely(slot != NULL)) {
1009 PyObject *x = slot(coerced1, coerced2);
1011 Py_DECREF(coerced1);
1012 Py_DECREF(coerced2);
1015 goto exit_inplace_result_object;
1020 Py_DECREF(coerced1);
1021 Py_DECREF(coerced2);
1027#if PYTHON_VERSION < 0x300
1028 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'long' and '%s'", type2->tp_name);
1030 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'int' and '%s'", type2->tp_name);
1032 goto exit_inplace_exception;
1035exit_inplace_result_object:
1036 if (unlikely(obj_result == NULL)) {
1041 Py_DECREF(*operand1);
1045 *operand1 = obj_result;
1049exit_inplace_exception:
1052static inline bool _INPLACE_OPERATION_MOD_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1055 CHECK_OBJECT(*operand1);
1056 assert(PyLong_CheckExact(*operand1));
1057 CHECK_OBJECT(operand2);
1059 PyTypeObject *type2 = Py_TYPE(operand2);
1061 if (&PyLong_Type == type2) {
1065#if defined(_MSC_VER)
1066#pragma warning(push)
1067#pragma warning(disable : 4101)
1069 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1070 NUITKA_MAY_BE_UNUSED
long clong_result;
1071#if defined(_MSC_VER)
1075 PyObject *x = PyLong_Type.tp_as_number->nb_remainder(*operand1, operand2);
1076 assert(x != Py_NotImplemented);
1079 goto exit_result_object;
1082 if (unlikely(obj_result == NULL)) {
1083 goto exit_result_exception;
1086 Py_DECREF(*operand1);
1087 *operand1 = obj_result;
1088 goto exit_result_ok;
1093 exit_result_exception:
1097 return __INPLACE_OPERATION_MOD_LONG_OBJECT(operand1, operand2);
1100bool INPLACE_OPERATION_MOD_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1101 return _INPLACE_OPERATION_MOD_LONG_OBJECT(operand1, operand2);
1105static inline bool _INPLACE_OPERATION_MOD_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1108 CHECK_OBJECT(*operand1);
1109 assert(PyFloat_CheckExact(*operand1));
1110 CHECK_OBJECT(operand2);
1111 assert(PyFloat_CheckExact(operand2));
1113#if defined(_MSC_VER)
1114#pragma warning(push)
1115#pragma warning(disable : 4101)
1118 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1119 NUITKA_MAY_BE_UNUSED
long clong_result;
1120 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1121#if defined(_MSC_VER)
1125 CHECK_OBJECT(*operand1);
1126 assert(PyFloat_CheckExact(*operand1));
1127 CHECK_OBJECT(operand2);
1128 assert(PyFloat_CheckExact(operand2));
1130 const double a = PyFloat_AS_DOUBLE(*operand1);
1131 const double b = PyFloat_AS_DOUBLE(operand2);
1133 if (unlikely(b == 0.0)) {
1134 PyThreadState *tstate = PyThreadState_GET();
1136 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float modulo");
1137 goto exit_result_exception;
1141 double mod = fmod(a, b);
1143 if ((b < 0) != (mod < 0)) {
1147 mod = copysign(0.0, b);
1150 cfloat_result = mod;
1151 goto exit_result_ok_cfloat;
1154exit_result_ok_cfloat:
1155 if (Py_REFCNT(*operand1) == 1) {
1156 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1159 Py_DECREF(*operand1);
1161 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1163 goto exit_result_ok;
1168exit_result_exception:
1172bool INPLACE_OPERATION_MOD_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1173 return _INPLACE_OPERATION_MOD_FLOAT_FLOAT(operand1, operand2);
1177static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MOD_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1178 PyTypeObject *type1 = Py_TYPE(*operand1);
1180#if defined(_MSC_VER)
1181#pragma warning(push)
1182#pragma warning(disable : 4101)
1184 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1185 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1186#if defined(_MSC_VER)
1190 binaryfunc islot = (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1))
1191 ? type1->tp_as_number->nb_inplace_remainder
1194 if (islot != NULL) {
1195 PyObject *x = islot(*operand1, operand2);
1197 if (x != Py_NotImplemented) {
1199 goto exit_inplace_result_object;
1202 Py_DECREF_IMMORTAL(x);
1207 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_remainder : NULL;
1208 binaryfunc slot2 = NULL;
1210 if (!(type1 == &PyFloat_Type)) {
1213 slot2 = PyFloat_Type.tp_as_number->nb_remainder;
1215 if (slot1 == slot2) {
1220 if (slot1 != NULL) {
1221 PyObject *x = slot1(*operand1, operand2);
1223 if (x != Py_NotImplemented) {
1225 goto exit_inplace_result_object;
1228 Py_DECREF_IMMORTAL(x);
1231 if (slot2 != NULL) {
1232 PyObject *x = slot2(*operand1, operand2);
1234 if (x != Py_NotImplemented) {
1236 goto exit_inplace_result_object;
1239 Py_DECREF_IMMORTAL(x);
1242#if PYTHON_VERSION < 0x300
1243 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1245 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1248 PyObject *coerced1 = *operand1;
1249 PyObject *coerced2 = operand2;
1251 int err = c1(&coerced1, &coerced2);
1253 if (unlikely(err < 0)) {
1254 goto exit_inplace_exception;
1258 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1260 if (likely(mv == NULL)) {
1261 binaryfunc slot = mv->nb_remainder;
1263 if (likely(slot != NULL)) {
1264 PyObject *x = slot(coerced1, coerced2);
1266 Py_DECREF(coerced1);
1267 Py_DECREF(coerced2);
1270 goto exit_inplace_result_object;
1275 Py_DECREF(coerced1);
1276 Py_DECREF(coerced2);
1279 coercion c2 = PyFloat_Type.tp_as_number->nb_coerce;
1282 PyObject *coerced1 = *operand1;
1283 PyObject *coerced2 = operand2;
1285 int err = c2(&coerced2, &coerced1);
1287 if (unlikely(err < 0)) {
1288 goto exit_inplace_exception;
1292 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1294 if (likely(mv == NULL)) {
1295 binaryfunc slot = mv->nb_remainder;
1297 if (likely(slot != NULL)) {
1298 PyObject *x = slot(coerced1, coerced2);
1300 Py_DECREF(coerced1);
1301 Py_DECREF(coerced2);
1304 goto exit_inplace_result_object;
1309 Py_DECREF(coerced1);
1310 Py_DECREF(coerced2);
1316 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: '%s' and 'float'", type1->tp_name);
1317 goto exit_inplace_exception;
1320exit_inplace_result_object:
1321 if (unlikely(obj_result == NULL)) {
1326 Py_DECREF(*operand1);
1330 *operand1 = obj_result;
1334exit_inplace_exception:
1337static inline bool _INPLACE_OPERATION_MOD_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1340 CHECK_OBJECT(*operand1);
1341 CHECK_OBJECT(operand2);
1342 assert(PyFloat_CheckExact(operand2));
1344 PyTypeObject *type1 = Py_TYPE(*operand1);
1346 if (type1 == &PyFloat_Type) {
1349#if defined(_MSC_VER)
1350#pragma warning(push)
1351#pragma warning(disable : 4101)
1354 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1355 NUITKA_MAY_BE_UNUSED
long clong_result;
1356 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1357#if defined(_MSC_VER)
1361 CHECK_OBJECT(*operand1);
1362 assert(PyFloat_CheckExact(*operand1));
1363 CHECK_OBJECT(operand2);
1364 assert(PyFloat_CheckExact(operand2));
1366 const double a = PyFloat_AS_DOUBLE(*operand1);
1367 const double b = PyFloat_AS_DOUBLE(operand2);
1369 if (unlikely(b == 0.0)) {
1370 PyThreadState *tstate = PyThreadState_GET();
1372 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float modulo");
1373 goto exit_result_exception;
1377 double mod = fmod(a, b);
1379 if ((b < 0) != (mod < 0)) {
1383 mod = copysign(0.0, b);
1386 cfloat_result = mod;
1387 goto exit_result_ok_cfloat;
1390 exit_result_ok_cfloat:
1391 if (Py_REFCNT(*operand1) == 1) {
1392 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1395 Py_DECREF(*operand1);
1397 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1399 goto exit_result_ok;
1404 exit_result_exception:
1408 return __INPLACE_OPERATION_MOD_OBJECT_FLOAT(operand1, operand2);
1411bool INPLACE_OPERATION_MOD_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1412 return _INPLACE_OPERATION_MOD_OBJECT_FLOAT(operand1, operand2);
1416static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MOD_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1417 PyTypeObject *type2 = Py_TYPE(operand2);
1419#if defined(_MSC_VER)
1420#pragma warning(push)
1421#pragma warning(disable : 4101)
1423 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1424 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1425#if defined(_MSC_VER)
1432 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_remainder;
1433 binaryfunc slot2 = NULL;
1435 if (!(&PyFloat_Type == type2)) {
1438 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_remainder
1441 if (slot1 == slot2) {
1446 if (slot1 != NULL) {
1447 if (slot2 != NULL) {
1448 if (Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
1449 PyObject *x = slot2(*operand1, operand2);
1451 if (x != Py_NotImplemented) {
1453 goto exit_inplace_result_object;
1456 Py_DECREF_IMMORTAL(x);
1461 PyObject *x = slot1(*operand1, operand2);
1463 if (x != Py_NotImplemented) {
1465 goto exit_inplace_result_object;
1468 Py_DECREF_IMMORTAL(x);
1471 if (slot2 != NULL) {
1472 PyObject *x = slot2(*operand1, operand2);
1474 if (x != Py_NotImplemented) {
1476 goto exit_inplace_result_object;
1479 Py_DECREF_IMMORTAL(x);
1482#if PYTHON_VERSION < 0x300
1483 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1484 coercion c1 = PyFloat_Type.tp_as_number->nb_coerce;
1487 PyObject *coerced1 = *operand1;
1488 PyObject *coerced2 = operand2;
1490 int err = c1(&coerced1, &coerced2);
1492 if (unlikely(err < 0)) {
1493 goto exit_inplace_exception;
1497 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1499 if (likely(mv == NULL)) {
1500 binaryfunc slot = mv->nb_remainder;
1502 if (likely(slot != NULL)) {
1503 PyObject *x = slot(coerced1, coerced2);
1505 Py_DECREF(coerced1);
1506 Py_DECREF(coerced2);
1509 goto exit_inplace_result_object;
1514 Py_DECREF(coerced1);
1515 Py_DECREF(coerced2);
1519 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1522 PyObject *coerced1 = *operand1;
1523 PyObject *coerced2 = operand2;
1525 int err = c2(&coerced2, &coerced1);
1527 if (unlikely(err < 0)) {
1528 goto exit_inplace_exception;
1532 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1534 if (likely(mv == NULL)) {
1535 binaryfunc slot = mv->nb_remainder;
1537 if (likely(slot != NULL)) {
1538 PyObject *x = slot(coerced1, coerced2);
1540 Py_DECREF(coerced1);
1541 Py_DECREF(coerced2);
1544 goto exit_inplace_result_object;
1549 Py_DECREF(coerced1);
1550 Py_DECREF(coerced2);
1556 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'float' and '%s'", type2->tp_name);
1557 goto exit_inplace_exception;
1560exit_inplace_result_object:
1561 if (unlikely(obj_result == NULL)) {
1566 Py_DECREF(*operand1);
1570 *operand1 = obj_result;
1574exit_inplace_exception:
1577static inline bool _INPLACE_OPERATION_MOD_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1580 CHECK_OBJECT(*operand1);
1581 assert(PyFloat_CheckExact(*operand1));
1582 CHECK_OBJECT(operand2);
1584 PyTypeObject *type2 = Py_TYPE(operand2);
1586 if (&PyFloat_Type == type2) {
1589#if defined(_MSC_VER)
1590#pragma warning(push)
1591#pragma warning(disable : 4101)
1594 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1595 NUITKA_MAY_BE_UNUSED
long clong_result;
1596 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1597#if defined(_MSC_VER)
1601 CHECK_OBJECT(*operand1);
1602 assert(PyFloat_CheckExact(*operand1));
1603 CHECK_OBJECT(operand2);
1604 assert(PyFloat_CheckExact(operand2));
1606 const double a = PyFloat_AS_DOUBLE(*operand1);
1607 const double b = PyFloat_AS_DOUBLE(operand2);
1609 if (unlikely(b == 0.0)) {
1610 PyThreadState *tstate = PyThreadState_GET();
1612 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float modulo");
1613 goto exit_result_exception;
1617 double mod = fmod(a, b);
1619 if ((b < 0) != (mod < 0)) {
1623 mod = copysign(0.0, b);
1626 cfloat_result = mod;
1627 goto exit_result_ok_cfloat;
1630 exit_result_ok_cfloat:
1631 if (Py_REFCNT(*operand1) == 1) {
1632 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1635 Py_DECREF(*operand1);
1637 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1639 goto exit_result_ok;
1644 exit_result_exception:
1648 return __INPLACE_OPERATION_MOD_FLOAT_OBJECT(operand1, operand2);
1651bool INPLACE_OPERATION_MOD_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1652 return _INPLACE_OPERATION_MOD_FLOAT_OBJECT(operand1, operand2);
1656static inline bool _INPLACE_OPERATION_MOD_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1659 CHECK_OBJECT(*operand1);
1660 assert(PyFloat_CheckExact(*operand1));
1661 CHECK_OBJECT(operand2);
1662 assert(PyLong_CheckExact(operand2));
1664#if defined(_MSC_VER)
1665#pragma warning(push)
1666#pragma warning(disable : 4101)
1668 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1669 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1670#if defined(_MSC_VER)
1677 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_remainder;
1680 if (slot1 != NULL) {
1681 PyObject *x = slot1(*operand1, operand2);
1683 if (x != Py_NotImplemented) {
1685 goto exit_inplace_result_object;
1688 Py_DECREF_IMMORTAL(x);
1693#if PYTHON_VERSION < 0x300
1694 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'float' and 'long'");
1696 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'float' and 'int'");
1698 goto exit_inplace_exception;
1701exit_inplace_result_object:
1702 if (unlikely(obj_result == NULL)) {
1707 Py_DECREF(*operand1);
1711 *operand1 = obj_result;
1715exit_inplace_exception:
1719bool INPLACE_OPERATION_MOD_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1720 return _INPLACE_OPERATION_MOD_FLOAT_LONG(operand1, operand2);
1724static inline bool _INPLACE_OPERATION_MOD_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
1727 CHECK_OBJECT(*operand1);
1728 assert(PyLong_CheckExact(*operand1));
1729 CHECK_OBJECT(operand2);
1730 assert(PyFloat_CheckExact(operand2));
1732#if defined(_MSC_VER)
1733#pragma warning(push)
1734#pragma warning(disable : 4101)
1736 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1737 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1738#if defined(_MSC_VER)
1746 binaryfunc slot2 = NULL;
1751 slot2 = PyFloat_Type.tp_as_number->nb_remainder;
1754 if (slot2 != NULL) {
1755 PyObject *x = slot2(*operand1, operand2);
1757 if (x != Py_NotImplemented) {
1759 goto exit_inplace_result_object;
1762 Py_DECREF_IMMORTAL(x);
1767#if PYTHON_VERSION < 0x300
1768 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'long' and 'float'");
1770 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'int' and 'float'");
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:
1793bool INPLACE_OPERATION_MOD_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
1794 return _INPLACE_OPERATION_MOD_LONG_FLOAT(operand1, operand2);
1797#if PYTHON_VERSION < 0x300
1799static inline bool _INPLACE_OPERATION_MOD_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
1802 CHECK_OBJECT(*operand1);
1803 assert(PyFloat_CheckExact(*operand1));
1804 CHECK_OBJECT(operand2);
1805 assert(PyInt_CheckExact(operand2));
1807#if defined(_MSC_VER)
1808#pragma warning(push)
1809#pragma warning(disable : 4101)
1811 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1812 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1813#if defined(_MSC_VER)
1820 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_remainder;
1823 if (slot1 != NULL) {
1824 PyObject *x = slot1(*operand1, operand2);
1826 if (x != Py_NotImplemented) {
1828 goto exit_inplace_result_object;
1831 Py_DECREF_IMMORTAL(x);
1836 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'float' and 'int'");
1837 goto exit_inplace_exception;
1840exit_inplace_result_object:
1841 if (unlikely(obj_result == NULL)) {
1846 Py_DECREF(*operand1);
1850 *operand1 = obj_result;
1854exit_inplace_exception:
1858bool INPLACE_OPERATION_MOD_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
1859 return _INPLACE_OPERATION_MOD_FLOAT_INT(operand1, operand2);
1863#if PYTHON_VERSION < 0x300
1865static inline bool _INPLACE_OPERATION_MOD_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
1868 CHECK_OBJECT(*operand1);
1869 assert(PyInt_CheckExact(*operand1));
1870 CHECK_OBJECT(operand2);
1871 assert(PyFloat_CheckExact(operand2));
1873#if defined(_MSC_VER)
1874#pragma warning(push)
1875#pragma warning(disable : 4101)
1877 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1878 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1879#if defined(_MSC_VER)
1887 binaryfunc slot2 = NULL;
1892 slot2 = PyFloat_Type.tp_as_number->nb_remainder;
1895 if (slot2 != NULL) {
1896 PyObject *x = slot2(*operand1, operand2);
1898 if (x != Py_NotImplemented) {
1900 goto exit_inplace_result_object;
1903 Py_DECREF_IMMORTAL(x);
1908 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'int' and 'float'");
1909 goto exit_inplace_exception;
1912exit_inplace_result_object:
1913 if (unlikely(obj_result == NULL)) {
1918 Py_DECREF(*operand1);
1922 *operand1 = obj_result;
1926exit_inplace_exception:
1930bool INPLACE_OPERATION_MOD_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
1931 return _INPLACE_OPERATION_MOD_INT_FLOAT(operand1, operand2);
1935#if PYTHON_VERSION < 0x300
1937static inline bool _INPLACE_OPERATION_MOD_LONG_INT(PyObject **operand1, PyObject *operand2) {
1940 CHECK_OBJECT(*operand1);
1941 assert(PyLong_CheckExact(*operand1));
1942 CHECK_OBJECT(operand2);
1943 assert(PyInt_CheckExact(operand2));
1945#if defined(_MSC_VER)
1946#pragma warning(push)
1947#pragma warning(disable : 4101)
1949 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1950 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1951#if defined(_MSC_VER)
1958 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_remainder;
1961 if (slot1 != NULL) {
1962 PyObject *x = slot1(*operand1, operand2);
1964 if (x != Py_NotImplemented) {
1966 goto exit_inplace_result_object;
1969 Py_DECREF_IMMORTAL(x);
1974 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'long' and 'int'");
1975 goto exit_inplace_exception;
1978exit_inplace_result_object:
1979 if (unlikely(obj_result == NULL)) {
1984 Py_DECREF(*operand1);
1988 *operand1 = obj_result;
1992exit_inplace_exception:
1996bool INPLACE_OPERATION_MOD_LONG_INT(PyObject **operand1, PyObject *operand2) {
1997 return _INPLACE_OPERATION_MOD_LONG_INT(operand1, operand2);
2001#if PYTHON_VERSION < 0x300
2003static inline bool _INPLACE_OPERATION_MOD_INT_LONG(PyObject **operand1, PyObject *operand2) {
2006 CHECK_OBJECT(*operand1);
2007 assert(PyInt_CheckExact(*operand1));
2008 CHECK_OBJECT(operand2);
2009 assert(PyLong_CheckExact(operand2));
2011#if defined(_MSC_VER)
2012#pragma warning(push)
2013#pragma warning(disable : 4101)
2015 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2016 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2017#if defined(_MSC_VER)
2025 binaryfunc slot2 = NULL;
2030 slot2 = PyLong_Type.tp_as_number->nb_remainder;
2033 if (slot2 != NULL) {
2034 PyObject *x = slot2(*operand1, operand2);
2036 if (x != Py_NotImplemented) {
2038 goto exit_inplace_result_object;
2041 Py_DECREF_IMMORTAL(x);
2046 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'int' and 'long'");
2047 goto exit_inplace_exception;
2050exit_inplace_result_object:
2051 if (unlikely(obj_result == NULL)) {
2056 Py_DECREF(*operand1);
2060 *operand1 = obj_result;
2064exit_inplace_exception:
2068bool INPLACE_OPERATION_MOD_INT_LONG(PyObject **operand1, PyObject *operand2) {
2069 return _INPLACE_OPERATION_MOD_INT_LONG(operand1, operand2);
2073#if PYTHON_VERSION < 0x300
2075static inline bool _INPLACE_OPERATION_MOD_INT_CLONG(PyObject **operand1,
long operand2) {
2078 CHECK_OBJECT(*operand1);
2079 assert(PyInt_CheckExact(*operand1));
2082#if defined(_MSC_VER)
2083#pragma warning(push)
2084#pragma warning(disable : 4101)
2086 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2087 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2088 NUITKA_MAY_BE_UNUSED
long clong_result;
2089 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2090#if defined(_MSC_VER)
2094 CHECK_OBJECT(*operand1);
2095 assert(PyInt_CheckExact(*operand1));
2097 const long a = PyInt_AS_LONG(*operand1);
2098 const long b = operand2;
2106 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
2110 if (r != 0 && ((b ^ r) < 0)) {
2115 goto exit_result_ok_clong;
2119 PyObject *operand1_object = *operand1;
2120 PyObject *operand2_object = Nuitka_PyLong_FromLong(operand2);
2122 PyObject *r = PyLong_Type.tp_as_number->nb_remainder(operand1_object, operand2_object);
2123 assert(r != Py_NotImplemented);
2125 Py_DECREF(operand2_object);
2128 goto exit_result_object;
2131exit_result_ok_clong:
2134 Py_DECREF(*operand1);
2138 *operand1 = Nuitka_PyInt_FromLong(clong_result);
2139 goto exit_result_ok;
2142 if (unlikely(obj_result == NULL)) {
2143 goto exit_result_exception;
2146 Py_DECREF(*operand1);
2148 *operand1 = obj_result;
2149 goto exit_result_ok;
2154exit_result_exception:
2158bool INPLACE_OPERATION_MOD_INT_CLONG(PyObject **operand1,
long operand2) {
2159 return _INPLACE_OPERATION_MOD_INT_CLONG(operand1, operand2);
2164static inline bool _INPLACE_OPERATION_MOD_FLOAT_CFLOAT(PyObject **operand1,
double operand2) {
2167 CHECK_OBJECT(*operand1);
2168 assert(PyFloat_CheckExact(*operand1));
2170#if defined(_MSC_VER)
2171#pragma warning(push)
2172#pragma warning(disable : 4101)
2175 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2176 NUITKA_MAY_BE_UNUSED
long clong_result;
2177 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2178#if defined(_MSC_VER)
2182 CHECK_OBJECT(*operand1);
2183 assert(PyFloat_CheckExact(*operand1));
2185 const double a = PyFloat_AS_DOUBLE(*operand1);
2186 const double b = operand2;
2188 if (unlikely(b == 0.0)) {
2189 PyThreadState *tstate = PyThreadState_GET();
2191 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float modulo");
2192 goto exit_result_exception;
2196 double mod = fmod(a, b);
2198 if ((b < 0) != (mod < 0)) {
2202 mod = copysign(0.0, b);
2205 cfloat_result = mod;
2206 goto exit_result_ok_cfloat;
2209exit_result_ok_cfloat:
2210 if (Py_REFCNT(*operand1) == 1) {
2211 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
2214 Py_DECREF(*operand1);
2216 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2218 goto exit_result_ok;
2223exit_result_exception:
2227bool INPLACE_OPERATION_MOD_FLOAT_CFLOAT(PyObject **operand1,
double operand2) {
2228 return _INPLACE_OPERATION_MOD_FLOAT_CFLOAT(operand1, operand2);
2231#if PYTHON_VERSION < 0x300
2233static inline bool _INPLACE_OPERATION_MOD_STR_INT(PyObject **operand1, PyObject *operand2) {
2236 CHECK_OBJECT(*operand1);
2237 assert(PyString_CheckExact(*operand1));
2238 CHECK_OBJECT(operand2);
2239 assert(PyInt_CheckExact(operand2));
2241#if defined(_MSC_VER)
2242#pragma warning(push)
2243#pragma warning(disable : 4101)
2245 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2246 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2247#if defined(_MSC_VER)
2254 binaryfunc slot1 = PyString_Type.tp_as_number->nb_remainder;
2255 binaryfunc slot2 = NULL;
2260 slot2 = PyInt_Type.tp_as_number->nb_remainder;
2263 if (slot1 != NULL) {
2264 PyObject *x = slot1(*operand1, operand2);
2266 if (x != Py_NotImplemented) {
2268 goto exit_inplace_result_object;
2271 Py_DECREF_IMMORTAL(x);
2274 if (slot2 != NULL) {
2275 PyObject *x = slot2(*operand1, operand2);
2277 if (x != Py_NotImplemented) {
2279 goto exit_inplace_result_object;
2282 Py_DECREF_IMMORTAL(x);
2287 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'int'");
2288 goto exit_inplace_exception;
2291exit_inplace_result_object:
2292 if (unlikely(obj_result == NULL)) {
2297 Py_DECREF(*operand1);
2301 *operand1 = obj_result;
2305exit_inplace_exception:
2309bool INPLACE_OPERATION_MOD_STR_INT(PyObject **operand1, PyObject *operand2) {
2310 return _INPLACE_OPERATION_MOD_STR_INT(operand1, operand2);
2314#if PYTHON_VERSION < 0x300
2316static inline bool _INPLACE_OPERATION_MOD_STR_LONG(PyObject **operand1, PyObject *operand2) {
2319 CHECK_OBJECT(*operand1);
2320 assert(PyString_CheckExact(*operand1));
2321 CHECK_OBJECT(operand2);
2322 assert(PyLong_CheckExact(operand2));
2324#if defined(_MSC_VER)
2325#pragma warning(push)
2326#pragma warning(disable : 4101)
2328 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2329 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2330#if defined(_MSC_VER)
2337 binaryfunc slot1 = PyString_Type.tp_as_number->nb_remainder;
2338 binaryfunc slot2 = NULL;
2343 slot2 = PyLong_Type.tp_as_number->nb_remainder;
2346 if (slot1 != NULL) {
2347 PyObject *x = slot1(*operand1, operand2);
2349 if (x != Py_NotImplemented) {
2351 goto exit_inplace_result_object;
2354 Py_DECREF_IMMORTAL(x);
2357 if (slot2 != NULL) {
2358 PyObject *x = slot2(*operand1, operand2);
2360 if (x != Py_NotImplemented) {
2362 goto exit_inplace_result_object;
2365 Py_DECREF_IMMORTAL(x);
2370 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'long'");
2371 goto exit_inplace_exception;
2374exit_inplace_result_object:
2375 if (unlikely(obj_result == NULL)) {
2380 Py_DECREF(*operand1);
2384 *operand1 = obj_result;
2388exit_inplace_exception:
2392bool INPLACE_OPERATION_MOD_STR_LONG(PyObject **operand1, PyObject *operand2) {
2393 return _INPLACE_OPERATION_MOD_STR_LONG(operand1, operand2);
2397#if PYTHON_VERSION < 0x300
2399static inline bool _INPLACE_OPERATION_MOD_STR_FLOAT(PyObject **operand1, PyObject *operand2) {
2402 CHECK_OBJECT(*operand1);
2403 assert(PyString_CheckExact(*operand1));
2404 CHECK_OBJECT(operand2);
2405 assert(PyFloat_CheckExact(operand2));
2407#if defined(_MSC_VER)
2408#pragma warning(push)
2409#pragma warning(disable : 4101)
2411 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2412 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2413#if defined(_MSC_VER)
2420 binaryfunc slot1 = PyString_Type.tp_as_number->nb_remainder;
2421 binaryfunc slot2 = NULL;
2426 slot2 = PyFloat_Type.tp_as_number->nb_remainder;
2429 if (slot1 != NULL) {
2430 PyObject *x = slot1(*operand1, operand2);
2432 if (x != Py_NotImplemented) {
2434 goto exit_inplace_result_object;
2437 Py_DECREF_IMMORTAL(x);
2440 if (slot2 != NULL) {
2441 PyObject *x = slot2(*operand1, operand2);
2443 if (x != Py_NotImplemented) {
2445 goto exit_inplace_result_object;
2448 Py_DECREF_IMMORTAL(x);
2453 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'float'");
2454 goto exit_inplace_exception;
2457exit_inplace_result_object:
2458 if (unlikely(obj_result == NULL)) {
2463 Py_DECREF(*operand1);
2467 *operand1 = obj_result;
2471exit_inplace_exception:
2475bool INPLACE_OPERATION_MOD_STR_FLOAT(PyObject **operand1, PyObject *operand2) {
2476 return _INPLACE_OPERATION_MOD_STR_FLOAT(operand1, operand2);
2480#if PYTHON_VERSION < 0x300
2482static inline bool _INPLACE_OPERATION_MOD_STR_STR(PyObject **operand1, PyObject *operand2) {
2485 CHECK_OBJECT(*operand1);
2486 assert(PyString_CheckExact(*operand1));
2487 CHECK_OBJECT(operand2);
2488 assert(PyString_CheckExact(operand2));
2491 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2493 PyObject *x = PyString_Format(*operand1, operand2);
2496 goto exit_result_object;
2499 if (unlikely(obj_result == NULL)) {
2500 goto exit_result_exception;
2503 Py_DECREF(*operand1);
2505 *operand1 = obj_result;
2506 goto exit_result_ok;
2511exit_result_exception:
2515bool INPLACE_OPERATION_MOD_STR_STR(PyObject **operand1, PyObject *operand2) {
2516 return _INPLACE_OPERATION_MOD_STR_STR(operand1, operand2);
2520#if PYTHON_VERSION < 0x300
2522static inline bool _INPLACE_OPERATION_MOD_STR_UNICODE(PyObject **operand1, PyObject *operand2) {
2525 CHECK_OBJECT(*operand1);
2526 assert(PyString_CheckExact(*operand1));
2527 CHECK_OBJECT(operand2);
2528 assert(PyUnicode_CheckExact(operand2));
2530#if defined(_MSC_VER)
2531#pragma warning(push)
2532#pragma warning(disable : 4101)
2534 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2535 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2536#if defined(_MSC_VER)
2543 binaryfunc slot1 = PyString_Type.tp_as_number->nb_remainder;
2544 binaryfunc slot2 = NULL;
2549 slot2 = PyUnicode_Type.tp_as_number->nb_remainder;
2552 if (slot1 != NULL) {
2553 PyObject *x = slot1(*operand1, operand2);
2555 if (x != Py_NotImplemented) {
2557 goto exit_inplace_result_object;
2560 Py_DECREF_IMMORTAL(x);
2563 if (slot2 != NULL) {
2564 PyObject *x = slot2(*operand1, operand2);
2566 if (x != Py_NotImplemented) {
2568 goto exit_inplace_result_object;
2571 Py_DECREF_IMMORTAL(x);
2576 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'unicode'");
2577 goto exit_inplace_exception;
2580exit_inplace_result_object:
2581 if (unlikely(obj_result == NULL)) {
2586 Py_DECREF(*operand1);
2590 *operand1 = obj_result;
2594exit_inplace_exception:
2598bool INPLACE_OPERATION_MOD_STR_UNICODE(PyObject **operand1, PyObject *operand2) {
2599 return _INPLACE_OPERATION_MOD_STR_UNICODE(operand1, operand2);
2603#if PYTHON_VERSION < 0x300
2605static inline bool _INPLACE_OPERATION_MOD_STR_TUPLE(PyObject **operand1, PyObject *operand2) {
2608 CHECK_OBJECT(*operand1);
2609 assert(PyString_CheckExact(*operand1));
2610 CHECK_OBJECT(operand2);
2611 assert(PyTuple_CheckExact(operand2));
2613#if defined(_MSC_VER)
2614#pragma warning(push)
2615#pragma warning(disable : 4101)
2617 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2618 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2619#if defined(_MSC_VER)
2626 binaryfunc slot1 = PyString_Type.tp_as_number->nb_remainder;
2628 if (slot1 != NULL) {
2629 PyObject *x = slot1(*operand1, operand2);
2631 if (x != Py_NotImplemented) {
2633 goto exit_inplace_result_object;
2636 Py_DECREF_IMMORTAL(x);
2641 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'tuple'");
2642 goto exit_inplace_exception;
2645exit_inplace_result_object:
2646 if (unlikely(obj_result == NULL)) {
2651 Py_DECREF(*operand1);
2655 *operand1 = obj_result;
2659exit_inplace_exception:
2663bool INPLACE_OPERATION_MOD_STR_TUPLE(PyObject **operand1, PyObject *operand2) {
2664 return _INPLACE_OPERATION_MOD_STR_TUPLE(operand1, operand2);
2668#if PYTHON_VERSION < 0x300
2670static inline bool _INPLACE_OPERATION_MOD_STR_LIST(PyObject **operand1, PyObject *operand2) {
2673 CHECK_OBJECT(*operand1);
2674 assert(PyString_CheckExact(*operand1));
2675 CHECK_OBJECT(operand2);
2676 assert(PyList_CheckExact(operand2));
2678#if defined(_MSC_VER)
2679#pragma warning(push)
2680#pragma warning(disable : 4101)
2682 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2683 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2684#if defined(_MSC_VER)
2691 binaryfunc slot1 = PyString_Type.tp_as_number->nb_remainder;
2693 if (slot1 != NULL) {
2694 PyObject *x = slot1(*operand1, operand2);
2696 if (x != Py_NotImplemented) {
2698 goto exit_inplace_result_object;
2701 Py_DECREF_IMMORTAL(x);
2706 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'list'");
2707 goto exit_inplace_exception;
2710exit_inplace_result_object:
2711 if (unlikely(obj_result == NULL)) {
2716 Py_DECREF(*operand1);
2720 *operand1 = obj_result;
2724exit_inplace_exception:
2728bool INPLACE_OPERATION_MOD_STR_LIST(PyObject **operand1, PyObject *operand2) {
2729 return _INPLACE_OPERATION_MOD_STR_LIST(operand1, operand2);
2733#if PYTHON_VERSION < 0x300
2735static inline bool _INPLACE_OPERATION_MOD_STR_DICT(PyObject **operand1, PyObject *operand2) {
2738 CHECK_OBJECT(*operand1);
2739 assert(PyString_CheckExact(*operand1));
2740 CHECK_OBJECT(operand2);
2741 assert(PyDict_CheckExact(operand2));
2743#if defined(_MSC_VER)
2744#pragma warning(push)
2745#pragma warning(disable : 4101)
2747 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2748 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2749#if defined(_MSC_VER)
2756 binaryfunc slot1 = PyString_Type.tp_as_number->nb_remainder;
2758 if (slot1 != NULL) {
2759 PyObject *x = slot1(*operand1, operand2);
2761 if (x != Py_NotImplemented) {
2763 goto exit_inplace_result_object;
2766 Py_DECREF_IMMORTAL(x);
2771 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'dict'");
2772 goto exit_inplace_exception;
2775exit_inplace_result_object:
2776 if (unlikely(obj_result == NULL)) {
2781 Py_DECREF(*operand1);
2785 *operand1 = obj_result;
2789exit_inplace_exception:
2793bool INPLACE_OPERATION_MOD_STR_DICT(PyObject **operand1, PyObject *operand2) {
2794 return _INPLACE_OPERATION_MOD_STR_DICT(operand1, operand2);
2798#if PYTHON_VERSION < 0x300
2800static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MOD_STR_OBJECT(PyObject **operand1, PyObject *operand2) {
2801 PyTypeObject *type2 = Py_TYPE(operand2);
2803#if defined(_MSC_VER)
2804#pragma warning(push)
2805#pragma warning(disable : 4101)
2807 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2808 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2809#if defined(_MSC_VER)
2816 binaryfunc slot1 = PyString_Type.tp_as_number->nb_remainder;
2817 binaryfunc slot2 = NULL;
2819 if (!(&PyString_Type == type2)) {
2822 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_remainder
2825 if (slot1 == slot2) {
2830 if (slot1 != NULL) {
2831 if (slot2 != NULL) {
2832 if (Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
2833 PyObject *x = slot2(*operand1, operand2);
2835 if (x != Py_NotImplemented) {
2837 goto exit_inplace_result_object;
2840 Py_DECREF_IMMORTAL(x);
2845 PyObject *x = slot1(*operand1, operand2);
2847 if (x != Py_NotImplemented) {
2849 goto exit_inplace_result_object;
2852 Py_DECREF_IMMORTAL(x);
2855 if (slot2 != NULL) {
2856 PyObject *x = slot2(*operand1, operand2);
2858 if (x != Py_NotImplemented) {
2860 goto exit_inplace_result_object;
2863 Py_DECREF_IMMORTAL(x);
2866#if PYTHON_VERSION < 0x300
2867 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
2869 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2872 PyObject *coerced1 = *operand1;
2873 PyObject *coerced2 = operand2;
2875 int err = c2(&coerced2, &coerced1);
2877 if (unlikely(err < 0)) {
2878 goto exit_inplace_exception;
2882 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2884 if (likely(mv == NULL)) {
2885 binaryfunc slot = mv->nb_remainder;
2887 if (likely(slot != NULL)) {
2888 PyObject *x = slot(coerced1, coerced2);
2890 Py_DECREF(coerced1);
2891 Py_DECREF(coerced2);
2894 goto exit_inplace_result_object;
2899 Py_DECREF(coerced1);
2900 Py_DECREF(coerced2);
2906 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and '%s'", type2->tp_name);
2907 goto exit_inplace_exception;
2910exit_inplace_result_object:
2911 if (unlikely(obj_result == NULL)) {
2916 Py_DECREF(*operand1);
2920 *operand1 = obj_result;
2924exit_inplace_exception:
2927static inline bool _INPLACE_OPERATION_MOD_STR_OBJECT(PyObject **operand1, PyObject *operand2) {
2930 CHECK_OBJECT(*operand1);
2931 assert(PyString_CheckExact(*operand1));
2932 CHECK_OBJECT(operand2);
2934 PyTypeObject *type2 = Py_TYPE(operand2);
2936 if (&PyString_Type == type2) {
2940 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2942 PyObject *x = PyString_Format(*operand1, operand2);
2945 goto exit_result_object;
2948 if (unlikely(obj_result == NULL)) {
2949 goto exit_result_exception;
2952 Py_DECREF(*operand1);
2954 *operand1 = obj_result;
2955 goto exit_result_ok;
2960 exit_result_exception:
2964 return __INPLACE_OPERATION_MOD_STR_OBJECT(operand1, operand2);
2967bool INPLACE_OPERATION_MOD_STR_OBJECT(PyObject **operand1, PyObject *operand2) {
2968 return _INPLACE_OPERATION_MOD_STR_OBJECT(operand1, operand2);
2972#if PYTHON_VERSION < 0x300
2974static inline bool _INPLACE_OPERATION_MOD_UNICODE_INT(PyObject **operand1, PyObject *operand2) {
2977 CHECK_OBJECT(*operand1);
2978 assert(PyUnicode_CheckExact(*operand1));
2979 CHECK_OBJECT(operand2);
2980 assert(PyInt_CheckExact(operand2));
2982#if defined(_MSC_VER)
2983#pragma warning(push)
2984#pragma warning(disable : 4101)
2986 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2987 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2988#if defined(_MSC_VER)
2995 binaryfunc slot1 = PyUnicode_Type.tp_as_number->nb_remainder;
2996 binaryfunc slot2 = NULL;
3001 slot2 = PyInt_Type.tp_as_number->nb_remainder;
3004 if (slot1 != NULL) {
3005 PyObject *x = slot1(*operand1, operand2);
3007 if (x != Py_NotImplemented) {
3009 goto exit_inplace_result_object;
3012 Py_DECREF_IMMORTAL(x);
3015 if (slot2 != NULL) {
3016 PyObject *x = slot2(*operand1, operand2);
3018 if (x != Py_NotImplemented) {
3020 goto exit_inplace_result_object;
3023 Py_DECREF_IMMORTAL(x);
3028 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'unicode' and 'int'");
3029 goto exit_inplace_exception;
3032exit_inplace_result_object:
3033 if (unlikely(obj_result == NULL)) {
3038 Py_DECREF(*operand1);
3042 *operand1 = obj_result;
3046exit_inplace_exception:
3050bool INPLACE_OPERATION_MOD_UNICODE_INT(PyObject **operand1, PyObject *operand2) {
3051 return _INPLACE_OPERATION_MOD_UNICODE_INT(operand1, operand2);
3057static inline bool _INPLACE_OPERATION_MOD_UNICODE_LONG(PyObject **operand1, PyObject *operand2) {
3060 CHECK_OBJECT(*operand1);
3061 assert(PyUnicode_CheckExact(*operand1));
3062 CHECK_OBJECT(operand2);
3063 assert(PyLong_CheckExact(operand2));
3065#if defined(_MSC_VER)
3066#pragma warning(push)
3067#pragma warning(disable : 4101)
3069 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3070 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3071#if defined(_MSC_VER)
3078 binaryfunc slot1 = PyUnicode_Type.tp_as_number->nb_remainder;
3079 binaryfunc slot2 = NULL;
3084 slot2 = PyLong_Type.tp_as_number->nb_remainder;
3087 if (slot1 != NULL) {
3088 PyObject *x = slot1(*operand1, operand2);
3090 if (x != Py_NotImplemented) {
3092 goto exit_inplace_result_object;
3095 Py_DECREF_IMMORTAL(x);
3098 if (slot2 != NULL) {
3099 PyObject *x = slot2(*operand1, operand2);
3101 if (x != Py_NotImplemented) {
3103 goto exit_inplace_result_object;
3106 Py_DECREF_IMMORTAL(x);
3111#if PYTHON_VERSION < 0x300
3112 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'unicode' and 'long'");
3114 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'int'");
3116 goto exit_inplace_exception;
3119exit_inplace_result_object:
3120 if (unlikely(obj_result == NULL)) {
3125 Py_DECREF(*operand1);
3129 *operand1 = obj_result;
3133exit_inplace_exception:
3137bool INPLACE_OPERATION_MOD_UNICODE_LONG(PyObject **operand1, PyObject *operand2) {
3138 return _INPLACE_OPERATION_MOD_UNICODE_LONG(operand1, operand2);
3142static inline bool _INPLACE_OPERATION_MOD_UNICODE_FLOAT(PyObject **operand1, PyObject *operand2) {
3145 CHECK_OBJECT(*operand1);
3146 assert(PyUnicode_CheckExact(*operand1));
3147 CHECK_OBJECT(operand2);
3148 assert(PyFloat_CheckExact(operand2));
3150#if defined(_MSC_VER)
3151#pragma warning(push)
3152#pragma warning(disable : 4101)
3154 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3155 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3156#if defined(_MSC_VER)
3163 binaryfunc slot1 = PyUnicode_Type.tp_as_number->nb_remainder;
3164 binaryfunc slot2 = NULL;
3169 slot2 = PyFloat_Type.tp_as_number->nb_remainder;
3172 if (slot1 != NULL) {
3173 PyObject *x = slot1(*operand1, operand2);
3175 if (x != Py_NotImplemented) {
3177 goto exit_inplace_result_object;
3180 Py_DECREF_IMMORTAL(x);
3183 if (slot2 != NULL) {
3184 PyObject *x = slot2(*operand1, operand2);
3186 if (x != Py_NotImplemented) {
3188 goto exit_inplace_result_object;
3191 Py_DECREF_IMMORTAL(x);
3196#if PYTHON_VERSION < 0x300
3197 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'unicode' and 'float'");
3199 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'float'");
3201 goto exit_inplace_exception;
3204exit_inplace_result_object:
3205 if (unlikely(obj_result == NULL)) {
3210 Py_DECREF(*operand1);
3214 *operand1 = obj_result;
3218exit_inplace_exception:
3222bool INPLACE_OPERATION_MOD_UNICODE_FLOAT(PyObject **operand1, PyObject *operand2) {
3223 return _INPLACE_OPERATION_MOD_UNICODE_FLOAT(operand1, operand2);
3226#if PYTHON_VERSION < 0x300
3228static inline bool _INPLACE_OPERATION_MOD_UNICODE_STR(PyObject **operand1, PyObject *operand2) {
3231 CHECK_OBJECT(*operand1);
3232 assert(PyUnicode_CheckExact(*operand1));
3233 CHECK_OBJECT(operand2);
3234 assert(PyString_CheckExact(operand2));
3236#if defined(_MSC_VER)
3237#pragma warning(push)
3238#pragma warning(disable : 4101)
3240 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3241 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3242#if defined(_MSC_VER)
3249 binaryfunc slot1 = PyUnicode_Type.tp_as_number->nb_remainder;
3250 binaryfunc slot2 = NULL;
3255 slot2 = PyString_Type.tp_as_number->nb_remainder;
3258 if (slot1 != NULL) {
3259 PyObject *x = slot1(*operand1, operand2);
3261 if (x != Py_NotImplemented) {
3263 goto exit_inplace_result_object;
3266 Py_DECREF_IMMORTAL(x);
3269 if (slot2 != NULL) {
3270 PyObject *x = slot2(*operand1, operand2);
3272 if (x != Py_NotImplemented) {
3274 goto exit_inplace_result_object;
3277 Py_DECREF_IMMORTAL(x);
3282 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'unicode' and 'str'");
3283 goto exit_inplace_exception;
3286exit_inplace_result_object:
3287 if (unlikely(obj_result == NULL)) {
3292 Py_DECREF(*operand1);
3296 *operand1 = obj_result;
3300exit_inplace_exception:
3304bool INPLACE_OPERATION_MOD_UNICODE_STR(PyObject **operand1, PyObject *operand2) {
3305 return _INPLACE_OPERATION_MOD_UNICODE_STR(operand1, operand2);
3309#if PYTHON_VERSION >= 0x300
3311static inline bool _INPLACE_OPERATION_MOD_UNICODE_BYTES(PyObject **operand1, PyObject *operand2) {
3314 CHECK_OBJECT(*operand1);
3315 assert(PyUnicode_CheckExact(*operand1));
3316 CHECK_OBJECT(operand2);
3317 assert(PyBytes_CheckExact(operand2));
3319#if defined(_MSC_VER)
3320#pragma warning(push)
3321#pragma warning(disable : 4101)
3323 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3324 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3325#if defined(_MSC_VER)
3332 binaryfunc slot1 = PyUnicode_Type.tp_as_number->nb_remainder;
3333 binaryfunc slot2 = NULL;
3338 slot2 = PyBytes_Type.tp_as_number->nb_remainder;
3341 if (slot1 != NULL) {
3342 PyObject *x = slot1(*operand1, operand2);
3344 if (x != Py_NotImplemented) {
3346 goto exit_inplace_result_object;
3349 Py_DECREF_IMMORTAL(x);
3352 if (slot2 != NULL) {
3353 PyObject *x = slot2(*operand1, operand2);
3355 if (x != Py_NotImplemented) {
3357 goto exit_inplace_result_object;
3360 Py_DECREF_IMMORTAL(x);
3365 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'bytes'");
3366 goto exit_inplace_exception;
3369exit_inplace_result_object:
3370 if (unlikely(obj_result == NULL)) {
3375 Py_DECREF(*operand1);
3379 *operand1 = obj_result;
3383exit_inplace_exception:
3387bool INPLACE_OPERATION_MOD_UNICODE_BYTES(PyObject **operand1, PyObject *operand2) {
3388 return _INPLACE_OPERATION_MOD_UNICODE_BYTES(operand1, operand2);
3394static inline bool _INPLACE_OPERATION_MOD_UNICODE_UNICODE(PyObject **operand1, PyObject *operand2) {
3397 CHECK_OBJECT(*operand1);
3398 assert(PyUnicode_CheckExact(*operand1));
3399 CHECK_OBJECT(operand2);
3400 assert(PyUnicode_CheckExact(operand2));
3403 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3405 PyObject *x = PyUnicode_Format(*operand1, operand2);
3408 goto exit_result_object;
3411 if (unlikely(obj_result == NULL)) {
3412 goto exit_result_exception;
3415 Py_DECREF(*operand1);
3417 *operand1 = obj_result;
3418 goto exit_result_ok;
3423exit_result_exception:
3427bool INPLACE_OPERATION_MOD_UNICODE_UNICODE(PyObject **operand1, PyObject *operand2) {
3428 return _INPLACE_OPERATION_MOD_UNICODE_UNICODE(operand1, operand2);
3432static inline bool _INPLACE_OPERATION_MOD_UNICODE_TUPLE(PyObject **operand1, PyObject *operand2) {
3435 CHECK_OBJECT(*operand1);
3436 assert(PyUnicode_CheckExact(*operand1));
3437 CHECK_OBJECT(operand2);
3438 assert(PyTuple_CheckExact(operand2));
3440#if defined(_MSC_VER)
3441#pragma warning(push)
3442#pragma warning(disable : 4101)
3444 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3445 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3446#if defined(_MSC_VER)
3453 binaryfunc slot1 = PyUnicode_Type.tp_as_number->nb_remainder;
3455 if (slot1 != NULL) {
3456 PyObject *x = slot1(*operand1, operand2);
3458 if (x != Py_NotImplemented) {
3460 goto exit_inplace_result_object;
3463 Py_DECREF_IMMORTAL(x);
3468#if PYTHON_VERSION < 0x300
3469 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'unicode' and 'tuple'");
3471 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'tuple'");
3473 goto exit_inplace_exception;
3476exit_inplace_result_object:
3477 if (unlikely(obj_result == NULL)) {
3482 Py_DECREF(*operand1);
3486 *operand1 = obj_result;
3490exit_inplace_exception:
3494bool INPLACE_OPERATION_MOD_UNICODE_TUPLE(PyObject **operand1, PyObject *operand2) {
3495 return _INPLACE_OPERATION_MOD_UNICODE_TUPLE(operand1, operand2);
3499static inline bool _INPLACE_OPERATION_MOD_UNICODE_LIST(PyObject **operand1, PyObject *operand2) {
3502 CHECK_OBJECT(*operand1);
3503 assert(PyUnicode_CheckExact(*operand1));
3504 CHECK_OBJECT(operand2);
3505 assert(PyList_CheckExact(operand2));
3507#if defined(_MSC_VER)
3508#pragma warning(push)
3509#pragma warning(disable : 4101)
3511 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3512 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3513#if defined(_MSC_VER)
3520 binaryfunc slot1 = PyUnicode_Type.tp_as_number->nb_remainder;
3522 if (slot1 != NULL) {
3523 PyObject *x = slot1(*operand1, operand2);
3525 if (x != Py_NotImplemented) {
3527 goto exit_inplace_result_object;
3530 Py_DECREF_IMMORTAL(x);
3535#if PYTHON_VERSION < 0x300
3536 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'unicode' and 'list'");
3538 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'list'");
3540 goto exit_inplace_exception;
3543exit_inplace_result_object:
3544 if (unlikely(obj_result == NULL)) {
3549 Py_DECREF(*operand1);
3553 *operand1 = obj_result;
3557exit_inplace_exception:
3561bool INPLACE_OPERATION_MOD_UNICODE_LIST(PyObject **operand1, PyObject *operand2) {
3562 return _INPLACE_OPERATION_MOD_UNICODE_LIST(operand1, operand2);
3566static inline bool _INPLACE_OPERATION_MOD_UNICODE_DICT(PyObject **operand1, PyObject *operand2) {
3569 CHECK_OBJECT(*operand1);
3570 assert(PyUnicode_CheckExact(*operand1));
3571 CHECK_OBJECT(operand2);
3572 assert(PyDict_CheckExact(operand2));
3574#if defined(_MSC_VER)
3575#pragma warning(push)
3576#pragma warning(disable : 4101)
3578 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3579 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3580#if defined(_MSC_VER)
3587 binaryfunc slot1 = PyUnicode_Type.tp_as_number->nb_remainder;
3589 if (slot1 != NULL) {
3590 PyObject *x = slot1(*operand1, operand2);
3592 if (x != Py_NotImplemented) {
3594 goto exit_inplace_result_object;
3597 Py_DECREF_IMMORTAL(x);
3602#if PYTHON_VERSION < 0x300
3603 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'unicode' and 'dict'");
3605 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and 'dict'");
3607 goto exit_inplace_exception;
3610exit_inplace_result_object:
3611 if (unlikely(obj_result == NULL)) {
3616 Py_DECREF(*operand1);
3620 *operand1 = obj_result;
3624exit_inplace_exception:
3628bool INPLACE_OPERATION_MOD_UNICODE_DICT(PyObject **operand1, PyObject *operand2) {
3629 return _INPLACE_OPERATION_MOD_UNICODE_DICT(operand1, operand2);
3633static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MOD_UNICODE_OBJECT(PyObject **operand1, PyObject *operand2) {
3634 PyTypeObject *type2 = Py_TYPE(operand2);
3636#if defined(_MSC_VER)
3637#pragma warning(push)
3638#pragma warning(disable : 4101)
3640 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3641 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3642#if defined(_MSC_VER)
3649 binaryfunc slot1 = PyUnicode_Type.tp_as_number->nb_remainder;
3650 binaryfunc slot2 = NULL;
3652 if (!(&PyUnicode_Type == type2)) {
3655 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_remainder
3658 if (slot1 == slot2) {
3663 if (slot1 != NULL) {
3664 if (slot2 != NULL) {
3665 if (Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3666 PyObject *x = slot2(*operand1, operand2);
3668 if (x != Py_NotImplemented) {
3670 goto exit_inplace_result_object;
3673 Py_DECREF_IMMORTAL(x);
3678 PyObject *x = slot1(*operand1, operand2);
3680 if (x != Py_NotImplemented) {
3682 goto exit_inplace_result_object;
3685 Py_DECREF_IMMORTAL(x);
3688 if (slot2 != NULL) {
3689 PyObject *x = slot2(*operand1, operand2);
3691 if (x != Py_NotImplemented) {
3693 goto exit_inplace_result_object;
3696 Py_DECREF_IMMORTAL(x);
3699#if PYTHON_VERSION < 0x300
3700 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
3702 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
3705 PyObject *coerced1 = *operand1;
3706 PyObject *coerced2 = operand2;
3708 int err = c2(&coerced2, &coerced1);
3710 if (unlikely(err < 0)) {
3711 goto exit_inplace_exception;
3715 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
3717 if (likely(mv == NULL)) {
3718 binaryfunc slot = mv->nb_remainder;
3720 if (likely(slot != NULL)) {
3721 PyObject *x = slot(coerced1, coerced2);
3723 Py_DECREF(coerced1);
3724 Py_DECREF(coerced2);
3727 goto exit_inplace_result_object;
3732 Py_DECREF(coerced1);
3733 Py_DECREF(coerced2);
3739#if PYTHON_VERSION < 0x300
3740 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'unicode' and '%s'", type2->tp_name);
3742 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'str' and '%s'", type2->tp_name);
3744 goto exit_inplace_exception;
3747exit_inplace_result_object:
3748 if (unlikely(obj_result == NULL)) {
3753 Py_DECREF(*operand1);
3757 *operand1 = obj_result;
3761exit_inplace_exception:
3764static inline bool _INPLACE_OPERATION_MOD_UNICODE_OBJECT(PyObject **operand1, PyObject *operand2) {
3767 CHECK_OBJECT(*operand1);
3768 assert(PyUnicode_CheckExact(*operand1));
3769 CHECK_OBJECT(operand2);
3771 PyTypeObject *type2 = Py_TYPE(operand2);
3773 if (&PyUnicode_Type == type2) {
3777 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3779 PyObject *x = PyUnicode_Format(*operand1, operand2);
3782 goto exit_result_object;
3785 if (unlikely(obj_result == NULL)) {
3786 goto exit_result_exception;
3789 Py_DECREF(*operand1);
3791 *operand1 = obj_result;
3792 goto exit_result_ok;
3797 exit_result_exception:
3801 return __INPLACE_OPERATION_MOD_UNICODE_OBJECT(operand1, operand2);
3804bool INPLACE_OPERATION_MOD_UNICODE_OBJECT(PyObject **operand1, PyObject *operand2) {
3805 return _INPLACE_OPERATION_MOD_UNICODE_OBJECT(operand1, operand2);
3808#if PYTHON_VERSION >= 0x300
3810static inline bool _INPLACE_OPERATION_MOD_BYTES_LONG(PyObject **operand1, PyObject *operand2) {
3813 CHECK_OBJECT(*operand1);
3814 assert(PyBytes_CheckExact(*operand1));
3815 CHECK_OBJECT(operand2);
3816 assert(PyLong_CheckExact(operand2));
3818#if defined(_MSC_VER)
3819#pragma warning(push)
3820#pragma warning(disable : 4101)
3822 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3823 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3824#if defined(_MSC_VER)
3831 binaryfunc slot1 = PyBytes_Type.tp_as_number->nb_remainder;
3832 binaryfunc slot2 = NULL;
3837 slot2 = PyLong_Type.tp_as_number->nb_remainder;
3840 if (slot1 != NULL) {
3841 PyObject *x = slot1(*operand1, operand2);
3843 if (x != Py_NotImplemented) {
3845 goto exit_inplace_result_object;
3848 Py_DECREF_IMMORTAL(x);
3851 if (slot2 != NULL) {
3852 PyObject *x = slot2(*operand1, operand2);
3854 if (x != Py_NotImplemented) {
3856 goto exit_inplace_result_object;
3859 Py_DECREF_IMMORTAL(x);
3864 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'bytes' and 'int'");
3865 goto exit_inplace_exception;
3868exit_inplace_result_object:
3869 if (unlikely(obj_result == NULL)) {
3874 Py_DECREF(*operand1);
3878 *operand1 = obj_result;
3882exit_inplace_exception:
3886bool INPLACE_OPERATION_MOD_BYTES_LONG(PyObject **operand1, PyObject *operand2) {
3887 return _INPLACE_OPERATION_MOD_BYTES_LONG(operand1, operand2);
3891#if PYTHON_VERSION >= 0x300
3893static inline bool _INPLACE_OPERATION_MOD_BYTES_FLOAT(PyObject **operand1, PyObject *operand2) {
3896 CHECK_OBJECT(*operand1);
3897 assert(PyBytes_CheckExact(*operand1));
3898 CHECK_OBJECT(operand2);
3899 assert(PyFloat_CheckExact(operand2));
3901#if defined(_MSC_VER)
3902#pragma warning(push)
3903#pragma warning(disable : 4101)
3905 NUITKA_MAY_BE_UNUSED
bool cbool_result;
3906 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3907#if defined(_MSC_VER)
3914 binaryfunc slot1 = PyBytes_Type.tp_as_number->nb_remainder;
3915 binaryfunc slot2 = NULL;
3920 slot2 = PyFloat_Type.tp_as_number->nb_remainder;
3923 if (slot1 != NULL) {
3924 PyObject *x = slot1(*operand1, operand2);
3926 if (x != Py_NotImplemented) {
3928 goto exit_inplace_result_object;
3931 Py_DECREF_IMMORTAL(x);
3934 if (slot2 != NULL) {
3935 PyObject *x = slot2(*operand1, operand2);
3937 if (x != Py_NotImplemented) {
3939 goto exit_inplace_result_object;
3942 Py_DECREF_IMMORTAL(x);
3947 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'bytes' and 'float'");
3948 goto exit_inplace_exception;
3951exit_inplace_result_object:
3952 if (unlikely(obj_result == NULL)) {
3957 Py_DECREF(*operand1);
3961 *operand1 = obj_result;
3965exit_inplace_exception:
3969bool INPLACE_OPERATION_MOD_BYTES_FLOAT(PyObject **operand1, PyObject *operand2) {
3970 return _INPLACE_OPERATION_MOD_BYTES_FLOAT(operand1, operand2);
3974#if PYTHON_VERSION >= 0x300
3976static inline bool _INPLACE_OPERATION_MOD_BYTES_BYTES(PyObject **operand1, PyObject *operand2) {
3979 CHECK_OBJECT(*operand1);
3980 assert(PyBytes_CheckExact(*operand1));
3981 CHECK_OBJECT(operand2);
3982 assert(PyBytes_CheckExact(operand2));
3985 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3987 PyObject *x = PyBytes_Type.tp_as_number->nb_remainder(*operand1, operand2);
3988 assert(x != Py_NotImplemented);
3991 goto exit_result_object;
3994 if (unlikely(obj_result == NULL)) {
3995 goto exit_result_exception;
3998 Py_DECREF(*operand1);
4000 *operand1 = obj_result;
4001 goto exit_result_ok;
4006exit_result_exception:
4010bool INPLACE_OPERATION_MOD_BYTES_BYTES(PyObject **operand1, PyObject *operand2) {
4011 return _INPLACE_OPERATION_MOD_BYTES_BYTES(operand1, operand2);
4015#if PYTHON_VERSION >= 0x300
4017static inline bool _INPLACE_OPERATION_MOD_BYTES_UNICODE(PyObject **operand1, PyObject *operand2) {
4020 CHECK_OBJECT(*operand1);
4021 assert(PyBytes_CheckExact(*operand1));
4022 CHECK_OBJECT(operand2);
4023 assert(PyUnicode_CheckExact(operand2));
4025#if defined(_MSC_VER)
4026#pragma warning(push)
4027#pragma warning(disable : 4101)
4029 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4030 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4031#if defined(_MSC_VER)
4038 binaryfunc slot1 = PyBytes_Type.tp_as_number->nb_remainder;
4039 binaryfunc slot2 = NULL;
4044 slot2 = PyUnicode_Type.tp_as_number->nb_remainder;
4047 if (slot1 != NULL) {
4048 PyObject *x = slot1(*operand1, operand2);
4050 if (x != Py_NotImplemented) {
4052 goto exit_inplace_result_object;
4055 Py_DECREF_IMMORTAL(x);
4058 if (slot2 != NULL) {
4059 PyObject *x = slot2(*operand1, operand2);
4061 if (x != Py_NotImplemented) {
4063 goto exit_inplace_result_object;
4066 Py_DECREF_IMMORTAL(x);
4071 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'bytes' and 'str'");
4072 goto exit_inplace_exception;
4075exit_inplace_result_object:
4076 if (unlikely(obj_result == NULL)) {
4081 Py_DECREF(*operand1);
4085 *operand1 = obj_result;
4089exit_inplace_exception:
4093bool INPLACE_OPERATION_MOD_BYTES_UNICODE(PyObject **operand1, PyObject *operand2) {
4094 return _INPLACE_OPERATION_MOD_BYTES_UNICODE(operand1, operand2);
4098#if PYTHON_VERSION >= 0x300
4100static inline bool _INPLACE_OPERATION_MOD_BYTES_TUPLE(PyObject **operand1, PyObject *operand2) {
4103 CHECK_OBJECT(*operand1);
4104 assert(PyBytes_CheckExact(*operand1));
4105 CHECK_OBJECT(operand2);
4106 assert(PyTuple_CheckExact(operand2));
4108#if defined(_MSC_VER)
4109#pragma warning(push)
4110#pragma warning(disable : 4101)
4112 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4113 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4114#if defined(_MSC_VER)
4121 binaryfunc slot1 = PyBytes_Type.tp_as_number->nb_remainder;
4123 if (slot1 != NULL) {
4124 PyObject *x = slot1(*operand1, operand2);
4126 if (x != Py_NotImplemented) {
4128 goto exit_inplace_result_object;
4131 Py_DECREF_IMMORTAL(x);
4136 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'bytes' and 'tuple'");
4137 goto exit_inplace_exception;
4140exit_inplace_result_object:
4141 if (unlikely(obj_result == NULL)) {
4146 Py_DECREF(*operand1);
4150 *operand1 = obj_result;
4154exit_inplace_exception:
4158bool INPLACE_OPERATION_MOD_BYTES_TUPLE(PyObject **operand1, PyObject *operand2) {
4159 return _INPLACE_OPERATION_MOD_BYTES_TUPLE(operand1, operand2);
4163#if PYTHON_VERSION >= 0x300
4165static inline bool _INPLACE_OPERATION_MOD_BYTES_LIST(PyObject **operand1, PyObject *operand2) {
4168 CHECK_OBJECT(*operand1);
4169 assert(PyBytes_CheckExact(*operand1));
4170 CHECK_OBJECT(operand2);
4171 assert(PyList_CheckExact(operand2));
4173#if defined(_MSC_VER)
4174#pragma warning(push)
4175#pragma warning(disable : 4101)
4177 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4178 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4179#if defined(_MSC_VER)
4186 binaryfunc slot1 = PyBytes_Type.tp_as_number->nb_remainder;
4188 if (slot1 != NULL) {
4189 PyObject *x = slot1(*operand1, operand2);
4191 if (x != Py_NotImplemented) {
4193 goto exit_inplace_result_object;
4196 Py_DECREF_IMMORTAL(x);
4201 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'bytes' and 'list'");
4202 goto exit_inplace_exception;
4205exit_inplace_result_object:
4206 if (unlikely(obj_result == NULL)) {
4211 Py_DECREF(*operand1);
4215 *operand1 = obj_result;
4219exit_inplace_exception:
4223bool INPLACE_OPERATION_MOD_BYTES_LIST(PyObject **operand1, PyObject *operand2) {
4224 return _INPLACE_OPERATION_MOD_BYTES_LIST(operand1, operand2);
4228#if PYTHON_VERSION >= 0x300
4230static inline bool _INPLACE_OPERATION_MOD_BYTES_DICT(PyObject **operand1, PyObject *operand2) {
4233 CHECK_OBJECT(*operand1);
4234 assert(PyBytes_CheckExact(*operand1));
4235 CHECK_OBJECT(operand2);
4236 assert(PyDict_CheckExact(operand2));
4238#if defined(_MSC_VER)
4239#pragma warning(push)
4240#pragma warning(disable : 4101)
4242 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4243 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4244#if defined(_MSC_VER)
4251 binaryfunc slot1 = PyBytes_Type.tp_as_number->nb_remainder;
4253 if (slot1 != NULL) {
4254 PyObject *x = slot1(*operand1, operand2);
4256 if (x != Py_NotImplemented) {
4258 goto exit_inplace_result_object;
4261 Py_DECREF_IMMORTAL(x);
4266 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'bytes' and 'dict'");
4267 goto exit_inplace_exception;
4270exit_inplace_result_object:
4271 if (unlikely(obj_result == NULL)) {
4276 Py_DECREF(*operand1);
4280 *operand1 = obj_result;
4284exit_inplace_exception:
4288bool INPLACE_OPERATION_MOD_BYTES_DICT(PyObject **operand1, PyObject *operand2) {
4289 return _INPLACE_OPERATION_MOD_BYTES_DICT(operand1, operand2);
4293#if PYTHON_VERSION >= 0x300
4295static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_MOD_BYTES_OBJECT(PyObject **operand1, PyObject *operand2) {
4296 PyTypeObject *type2 = Py_TYPE(operand2);
4298#if defined(_MSC_VER)
4299#pragma warning(push)
4300#pragma warning(disable : 4101)
4302 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4303 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4304#if defined(_MSC_VER)
4311 binaryfunc slot1 = PyBytes_Type.tp_as_number->nb_remainder;
4312 binaryfunc slot2 = NULL;
4314 if (!(&PyBytes_Type == type2)) {
4317 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_remainder
4320 if (slot1 == slot2) {
4325 if (slot1 != NULL) {
4326 if (slot2 != NULL) {
4327 if (Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4328 PyObject *x = slot2(*operand1, operand2);
4330 if (x != Py_NotImplemented) {
4332 goto exit_inplace_result_object;
4335 Py_DECREF_IMMORTAL(x);
4340 PyObject *x = slot1(*operand1, operand2);
4342 if (x != Py_NotImplemented) {
4344 goto exit_inplace_result_object;
4347 Py_DECREF_IMMORTAL(x);
4350 if (slot2 != NULL) {
4351 PyObject *x = slot2(*operand1, operand2);
4353 if (x != Py_NotImplemented) {
4355 goto exit_inplace_result_object;
4358 Py_DECREF_IMMORTAL(x);
4361#if PYTHON_VERSION < 0x300
4362 if (!0 || !NEW_STYLE_NUMBER_TYPE(type2)) {
4364 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4367 PyObject *coerced1 = *operand1;
4368 PyObject *coerced2 = operand2;
4370 int err = c2(&coerced2, &coerced1);
4372 if (unlikely(err < 0)) {
4373 goto exit_inplace_exception;
4377 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4379 if (likely(mv == NULL)) {
4380 binaryfunc slot = mv->nb_remainder;
4382 if (likely(slot != NULL)) {
4383 PyObject *x = slot(coerced1, coerced2);
4385 Py_DECREF(coerced1);
4386 Py_DECREF(coerced2);
4389 goto exit_inplace_result_object;
4394 Py_DECREF(coerced1);
4395 Py_DECREF(coerced2);
4401 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: 'bytes' and '%s'", type2->tp_name);
4402 goto exit_inplace_exception;
4405exit_inplace_result_object:
4406 if (unlikely(obj_result == NULL)) {
4411 Py_DECREF(*operand1);
4415 *operand1 = obj_result;
4419exit_inplace_exception:
4422static inline bool _INPLACE_OPERATION_MOD_BYTES_OBJECT(PyObject **operand1, PyObject *operand2) {
4425 CHECK_OBJECT(*operand1);
4426 assert(PyBytes_CheckExact(*operand1));
4427 CHECK_OBJECT(operand2);
4429 PyTypeObject *type2 = Py_TYPE(operand2);
4431 if (&PyBytes_Type == type2) {
4435 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4437 PyObject *x = PyBytes_Type.tp_as_number->nb_remainder(*operand1, operand2);
4438 assert(x != Py_NotImplemented);
4441 goto exit_result_object;
4444 if (unlikely(obj_result == NULL)) {
4445 goto exit_result_exception;
4448 Py_DECREF(*operand1);
4450 *operand1 = obj_result;
4451 goto exit_result_ok;
4456 exit_result_exception:
4460 return __INPLACE_OPERATION_MOD_BYTES_OBJECT(operand1, operand2);
4463bool INPLACE_OPERATION_MOD_BYTES_OBJECT(PyObject **operand1, PyObject *operand2) {
4464 return _INPLACE_OPERATION_MOD_BYTES_OBJECT(operand1, operand2);
4469static inline bool _INPLACE_OPERATION_MOD_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
4472 CHECK_OBJECT(*operand1);
4473 CHECK_OBJECT(operand2);
4475#if PYTHON_VERSION < 0x300
4476 if (PyInt_CheckExact(*operand1) && PyInt_CheckExact(operand2)) {
4479#if defined(_MSC_VER)
4480#pragma warning(push)
4481#pragma warning(disable : 4101)
4483 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4484 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4485 NUITKA_MAY_BE_UNUSED
long clong_result;
4486 NUITKA_MAY_BE_UNUSED
double cfloat_result;
4487#if defined(_MSC_VER)
4491 CHECK_OBJECT(*operand1);
4492 assert(PyInt_CheckExact(*operand1));
4493 CHECK_OBJECT(operand2);
4494 assert(PyInt_CheckExact(operand2));
4496 const long a = PyInt_AS_LONG(*operand1);
4497 const long b = PyInt_AS_LONG(operand2);
4505 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
4509 if (r != 0 && ((b ^ r) < 0)) {
4514 goto exit_result_ok_clong;
4518 PyObject *operand1_object = *operand1;
4519 PyObject *operand2_object = operand2;
4521 PyObject *r = PyLong_Type.tp_as_number->nb_remainder(operand1_object, operand2_object);
4522 assert(r != Py_NotImplemented);
4525 goto exit_result_object;
4528 exit_result_ok_clong:
4531 Py_DECREF(*operand1);
4535 *operand1 = Nuitka_PyInt_FromLong(clong_result);
4536 goto exit_result_ok;
4539 if (unlikely(obj_result == NULL)) {
4540 goto exit_result_exception;
4543 Py_DECREF(*operand1);
4545 *operand1 = obj_result;
4546 goto exit_result_ok;
4551 exit_result_exception:
4556 if (Py_TYPE(*operand1) == Py_TYPE(operand2)) {
4557 if (PyFloat_CheckExact(operand2)) {
4558 return _INPLACE_OPERATION_MOD_FLOAT_FLOAT(operand1, operand2);
4560#if PYTHON_VERSION >= 0x300
4561 if (PyLong_CheckExact(operand2)) {
4562 return _INPLACE_OPERATION_MOD_LONG_LONG(operand1, operand2);
4567 PyTypeObject *type1 = Py_TYPE(*operand1);
4568 PyTypeObject *type2 = Py_TYPE(operand2);
4570#if defined(_MSC_VER)
4571#pragma warning(push)
4572#pragma warning(disable : 4101)
4574 NUITKA_MAY_BE_UNUSED
bool cbool_result;
4575 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4576#if defined(_MSC_VER)
4580 binaryfunc islot = (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1))
4581 ? type1->tp_as_number->nb_inplace_remainder
4584 if (islot != NULL) {
4585 PyObject *x = islot(*operand1, operand2);
4587 if (x != Py_NotImplemented) {
4589 goto exit_inplace_result_object;
4592 Py_DECREF_IMMORTAL(x);
4597 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_remainder : NULL;
4598 binaryfunc slot2 = NULL;
4600 if (!(type1 == type2)) {
4603 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_remainder
4606 if (slot1 == slot2) {
4611 if (slot1 != NULL) {
4612 if (slot2 != NULL) {
4613 if (Nuitka_Type_IsSubtype(type2, type1)) {
4614 PyObject *x = slot2(*operand1, operand2);
4616 if (x != Py_NotImplemented) {
4618 goto exit_inplace_result_object;
4621 Py_DECREF_IMMORTAL(x);
4626 PyObject *x = slot1(*operand1, operand2);
4628 if (x != Py_NotImplemented) {
4630 goto exit_inplace_result_object;
4633 Py_DECREF_IMMORTAL(x);
4636 if (slot2 != NULL) {
4637 PyObject *x = slot2(*operand1, operand2);
4639 if (x != Py_NotImplemented) {
4641 goto exit_inplace_result_object;
4644 Py_DECREF_IMMORTAL(x);
4647#if PYTHON_VERSION < 0x300
4648 if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
4650 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
4653 PyObject *coerced1 = *operand1;
4654 PyObject *coerced2 = operand2;
4656 int err = c1(&coerced1, &coerced2);
4658 if (unlikely(err < 0)) {
4659 goto exit_inplace_exception;
4663 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4665 if (likely(mv == NULL)) {
4666 binaryfunc slot = mv->nb_remainder;
4668 if (likely(slot != NULL)) {
4669 PyObject *x = slot(coerced1, coerced2);
4671 Py_DECREF(coerced1);
4672 Py_DECREF(coerced2);
4675 goto exit_inplace_result_object;
4680 Py_DECREF(coerced1);
4681 Py_DECREF(coerced2);
4685 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4688 PyObject *coerced1 = *operand1;
4689 PyObject *coerced2 = operand2;
4691 int err = c2(&coerced2, &coerced1);
4693 if (unlikely(err < 0)) {
4694 goto exit_inplace_exception;
4698 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4700 if (likely(mv == NULL)) {
4701 binaryfunc slot = mv->nb_remainder;
4703 if (likely(slot != NULL)) {
4704 PyObject *x = slot(coerced1, coerced2);
4706 Py_DECREF(coerced1);
4707 Py_DECREF(coerced2);
4710 goto exit_inplace_result_object;
4715 Py_DECREF(coerced1);
4716 Py_DECREF(coerced2);
4722 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for %%=: '%s' and '%s'", type1->tp_name,
4724 goto exit_inplace_exception;
4727exit_inplace_result_object:
4728 if (unlikely(obj_result == NULL)) {
4733 Py_DECREF(*operand1);
4737 *operand1 = obj_result;
4741exit_inplace_exception:
4745bool INPLACE_OPERATION_MOD_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
4746 return _INPLACE_OPERATION_MOD_OBJECT_OBJECT(operand1, operand2);