7#include "nuitka/prelude.h"
12#if PYTHON_VERSION < 0x300
14static inline bool _INPLACE_OPERATION_OLDDIV_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 if (unlikely(b == 0)) {
44 PyThreadState *tstate = PyThreadState_GET();
46 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"integer division or modulo by zero");
47 goto exit_result_exception;
56 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
58 long a_mod_b = (long)(a - (
unsigned long)a_div_b * b);
60 if (a_mod_b && (b ^ a_mod_b) < 0) {
65 clong_result = a_div_b;
66 goto exit_result_ok_clong;
70 PyObject *operand1_object = *operand1;
71 PyObject *operand2_object = operand2;
73 PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
74 assert(r != Py_NotImplemented);
77 goto exit_result_object;
87 *operand1 = Nuitka_PyInt_FromLong(clong_result);
91 if (unlikely(obj_result == NULL)) {
92 goto exit_result_exception;
97 *operand1 = obj_result;
103exit_result_exception:
107bool INPLACE_OPERATION_OLDDIV_INT_INT(PyObject **operand1, PyObject *operand2) {
108 return _INPLACE_OPERATION_OLDDIV_INT_INT(operand1, operand2);
112#if PYTHON_VERSION < 0x300
114static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_OLDDIV_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
115 PyTypeObject *type1 = Py_TYPE(*operand1);
119#pragma warning(disable : 4101)
121 NUITKA_MAY_BE_UNUSED
bool cbool_result;
122 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
128 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_divide : NULL;
131 PyObject *x = islot(*operand1, operand2);
133 if (x != Py_NotImplemented) {
135 goto exit_inplace_result_object;
138 Py_DECREF_IMMORTAL(x);
143 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
144 binaryfunc slot2 = NULL;
146 if (!(type1 == &PyInt_Type)) {
149 slot2 = PyInt_Type.tp_as_number->nb_divide;
151 if (slot1 == slot2) {
157 PyObject *x = slot1(*operand1, operand2);
159 if (x != Py_NotImplemented) {
161 goto exit_inplace_result_object;
164 Py_DECREF_IMMORTAL(x);
168 PyObject *x = slot2(*operand1, operand2);
170 if (x != Py_NotImplemented) {
172 goto exit_inplace_result_object;
175 Py_DECREF_IMMORTAL(x);
178#if PYTHON_VERSION < 0x300
179 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
181 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
184 PyObject *coerced1 = *operand1;
185 PyObject *coerced2 = operand2;
187 int err = c1(&coerced1, &coerced2);
189 if (unlikely(err < 0)) {
190 goto exit_inplace_exception;
194 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
196 if (likely(mv == NULL)) {
197 binaryfunc slot = mv->nb_divide;
199 if (likely(slot != NULL)) {
200 PyObject *x = slot(coerced1, coerced2);
206 goto exit_inplace_result_object;
215 coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
218 PyObject *coerced1 = *operand1;
219 PyObject *coerced2 = operand2;
221 int err = c2(&coerced2, &coerced1);
223 if (unlikely(err < 0)) {
224 goto exit_inplace_exception;
228 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
230 if (likely(mv == NULL)) {
231 binaryfunc slot = mv->nb_divide;
233 if (likely(slot != NULL)) {
234 PyObject *x = slot(coerced1, coerced2);
240 goto exit_inplace_result_object;
252 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: '%s' and 'int'", type1->tp_name);
253 goto exit_inplace_exception;
256exit_inplace_result_object:
257 if (unlikely(obj_result == NULL)) {
262 Py_DECREF(*operand1);
266 *operand1 = obj_result;
270exit_inplace_exception:
273static inline bool _INPLACE_OPERATION_OLDDIV_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
276 CHECK_OBJECT(*operand1);
277 CHECK_OBJECT(operand2);
278 assert(PyInt_CheckExact(operand2));
280 PyTypeObject *type1 = Py_TYPE(*operand1);
282 if (type1 == &PyInt_Type) {
288#pragma warning(disable : 4101)
290 NUITKA_MAY_BE_UNUSED
bool cbool_result;
291 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
292 NUITKA_MAY_BE_UNUSED
long clong_result;
293 NUITKA_MAY_BE_UNUSED
double cfloat_result;
298 CHECK_OBJECT(*operand1);
299 assert(PyInt_CheckExact(*operand1));
300 CHECK_OBJECT(operand2);
301 assert(PyInt_CheckExact(operand2));
303 const long a = PyInt_AS_LONG(*operand1);
304 const long b = PyInt_AS_LONG(operand2);
306 if (unlikely(b == 0)) {
307 PyThreadState *tstate = PyThreadState_GET();
309 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"integer division or modulo by zero");
310 goto exit_result_exception;
319 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
320 long a_div_b = a / b;
321 long a_mod_b = (long)(a - (
unsigned long)a_div_b * b);
323 if (a_mod_b && (b ^ a_mod_b) < 0) {
328 clong_result = a_div_b;
329 goto exit_result_ok_clong;
333 PyObject *operand1_object = *operand1;
334 PyObject *operand2_object = operand2;
336 PyObject *r = PyLong_Type.tp_as_number->nb_divide(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_OLDDIV_OBJECT_INT(operand1, operand2);
373bool INPLACE_OPERATION_OLDDIV_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
374 return _INPLACE_OPERATION_OLDDIV_OBJECT_INT(operand1, operand2);
378#if PYTHON_VERSION < 0x300
380static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_OLDDIV_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_divide;
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_divide : 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_divide;
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_divide;
501 if (likely(slot != NULL)) {
502 PyObject *x = slot(coerced1, coerced2);
508 goto exit_inplace_result_object;
520 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'int' and '%s'", type2->tp_name);
521 goto exit_inplace_exception;
524exit_inplace_result_object:
525 if (unlikely(obj_result == NULL)) {
530 Py_DECREF(*operand1);
534 *operand1 = obj_result;
538exit_inplace_exception:
541static inline bool _INPLACE_OPERATION_OLDDIV_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
544 CHECK_OBJECT(*operand1);
545 assert(PyInt_CheckExact(*operand1));
546 CHECK_OBJECT(operand2);
548 PyTypeObject *type2 = Py_TYPE(operand2);
550 if (&PyInt_Type == type2) {
556#pragma warning(disable : 4101)
558 NUITKA_MAY_BE_UNUSED
bool cbool_result;
559 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
560 NUITKA_MAY_BE_UNUSED
long clong_result;
561 NUITKA_MAY_BE_UNUSED
double cfloat_result;
566 CHECK_OBJECT(*operand1);
567 assert(PyInt_CheckExact(*operand1));
568 CHECK_OBJECT(operand2);
569 assert(PyInt_CheckExact(operand2));
571 const long a = PyInt_AS_LONG(*operand1);
572 const long b = PyInt_AS_LONG(operand2);
574 if (unlikely(b == 0)) {
575 PyThreadState *tstate = PyThreadState_GET();
577 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"integer division or modulo by zero");
578 goto exit_result_exception;
587 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
588 long a_div_b = a / b;
589 long a_mod_b = (long)(a - (
unsigned long)a_div_b * b);
591 if (a_mod_b && (b ^ a_mod_b) < 0) {
596 clong_result = a_div_b;
597 goto exit_result_ok_clong;
601 PyObject *operand1_object = *operand1;
602 PyObject *operand2_object = operand2;
604 PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
605 assert(r != Py_NotImplemented);
608 goto exit_result_object;
611 exit_result_ok_clong:
614 Py_DECREF(*operand1);
618 *operand1 = Nuitka_PyInt_FromLong(clong_result);
622 if (unlikely(obj_result == NULL)) {
623 goto exit_result_exception;
626 Py_DECREF(*operand1);
628 *operand1 = obj_result;
634 exit_result_exception:
638 return __INPLACE_OPERATION_OLDDIV_INT_OBJECT(operand1, operand2);
641bool INPLACE_OPERATION_OLDDIV_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
642 return _INPLACE_OPERATION_OLDDIV_INT_OBJECT(operand1, operand2);
646#if PYTHON_VERSION < 0x300
648static inline bool _INPLACE_OPERATION_OLDDIV_LONG_LONG(PyObject **operand1, PyObject *operand2) {
651 CHECK_OBJECT(*operand1);
652 assert(PyLong_CheckExact(*operand1));
653 CHECK_OBJECT(operand2);
654 assert(PyLong_CheckExact(operand2));
659#pragma warning(disable : 4101)
661 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
662 NUITKA_MAY_BE_UNUSED
long clong_result;
667 PyObject *x = PyLong_Type.tp_as_number->nb_divide(*operand1, operand2);
668 assert(x != Py_NotImplemented);
671 goto exit_result_object;
674 if (unlikely(obj_result == NULL)) {
675 goto exit_result_exception;
678 Py_DECREF(*operand1);
679 *operand1 = obj_result;
685exit_result_exception:
689bool INPLACE_OPERATION_OLDDIV_LONG_LONG(PyObject **operand1, PyObject *operand2) {
690 return _INPLACE_OPERATION_OLDDIV_LONG_LONG(operand1, operand2);
694#if PYTHON_VERSION < 0x300
696static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_OLDDIV_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
697 PyTypeObject *type1 = Py_TYPE(*operand1);
701#pragma warning(disable : 4101)
703 NUITKA_MAY_BE_UNUSED
bool cbool_result;
704 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
710 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_divide : NULL;
713 PyObject *x = islot(*operand1, operand2);
715 if (x != Py_NotImplemented) {
717 goto exit_inplace_result_object;
720 Py_DECREF_IMMORTAL(x);
725 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
726 binaryfunc slot2 = NULL;
728 if (!(type1 == &PyLong_Type)) {
731 slot2 = PyLong_Type.tp_as_number->nb_divide;
733 if (slot1 == slot2) {
739 PyObject *x = slot1(*operand1, operand2);
741 if (x != Py_NotImplemented) {
743 goto exit_inplace_result_object;
746 Py_DECREF_IMMORTAL(x);
750 PyObject *x = slot2(*operand1, operand2);
752 if (x != Py_NotImplemented) {
754 goto exit_inplace_result_object;
757 Py_DECREF_IMMORTAL(x);
760#if PYTHON_VERSION < 0x300
761 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
763 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
766 PyObject *coerced1 = *operand1;
767 PyObject *coerced2 = operand2;
769 int err = c1(&coerced1, &coerced2);
771 if (unlikely(err < 0)) {
772 goto exit_inplace_exception;
776 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
778 if (likely(mv == NULL)) {
779 binaryfunc slot = mv->nb_divide;
781 if (likely(slot != NULL)) {
782 PyObject *x = slot(coerced1, coerced2);
788 goto exit_inplace_result_object;
797 coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
800 PyObject *coerced1 = *operand1;
801 PyObject *coerced2 = operand2;
803 int err = c2(&coerced2, &coerced1);
805 if (unlikely(err < 0)) {
806 goto exit_inplace_exception;
810 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
812 if (likely(mv == NULL)) {
813 binaryfunc slot = mv->nb_divide;
815 if (likely(slot != NULL)) {
816 PyObject *x = slot(coerced1, coerced2);
822 goto exit_inplace_result_object;
834#if PYTHON_VERSION < 0x300
835 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: '%s' and 'long'", type1->tp_name);
837 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: '%s' and 'int'", type1->tp_name);
839 goto exit_inplace_exception;
842exit_inplace_result_object:
843 if (unlikely(obj_result == NULL)) {
848 Py_DECREF(*operand1);
852 *operand1 = obj_result;
856exit_inplace_exception:
859static inline bool _INPLACE_OPERATION_OLDDIV_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
862 CHECK_OBJECT(*operand1);
863 CHECK_OBJECT(operand2);
864 assert(PyLong_CheckExact(operand2));
866 PyTypeObject *type1 = Py_TYPE(*operand1);
868 if (type1 == &PyLong_Type) {
874#pragma warning(disable : 4101)
876 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
877 NUITKA_MAY_BE_UNUSED
long clong_result;
882 PyObject *x = PyLong_Type.tp_as_number->nb_divide(*operand1, operand2);
883 assert(x != Py_NotImplemented);
886 goto exit_result_object;
889 if (unlikely(obj_result == NULL)) {
890 goto exit_result_exception;
893 Py_DECREF(*operand1);
894 *operand1 = obj_result;
900 exit_result_exception:
904 return __INPLACE_OPERATION_OLDDIV_OBJECT_LONG(operand1, operand2);
907bool INPLACE_OPERATION_OLDDIV_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
908 return _INPLACE_OPERATION_OLDDIV_OBJECT_LONG(operand1, operand2);
912#if PYTHON_VERSION < 0x300
914static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_OLDDIV_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
915 PyTypeObject *type2 = Py_TYPE(operand2);
919#pragma warning(disable : 4101)
921 NUITKA_MAY_BE_UNUSED
bool cbool_result;
922 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
930 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_divide;
931 binaryfunc slot2 = NULL;
933 if (!(&PyLong_Type == type2)) {
937 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_divide : NULL;
939 if (slot1 == slot2) {
946 if (Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
947 PyObject *x = slot2(*operand1, operand2);
949 if (x != Py_NotImplemented) {
951 goto exit_inplace_result_object;
954 Py_DECREF_IMMORTAL(x);
959 PyObject *x = slot1(*operand1, operand2);
961 if (x != Py_NotImplemented) {
963 goto exit_inplace_result_object;
966 Py_DECREF_IMMORTAL(x);
970 PyObject *x = slot2(*operand1, operand2);
972 if (x != Py_NotImplemented) {
974 goto exit_inplace_result_object;
977 Py_DECREF_IMMORTAL(x);
980#if PYTHON_VERSION < 0x300
981 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
982 coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
985 PyObject *coerced1 = *operand1;
986 PyObject *coerced2 = operand2;
988 int err = c1(&coerced1, &coerced2);
990 if (unlikely(err < 0)) {
991 goto exit_inplace_exception;
995 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
997 if (likely(mv == NULL)) {
998 binaryfunc slot = mv->nb_divide;
1000 if (likely(slot != NULL)) {
1001 PyObject *x = slot(coerced1, coerced2);
1003 Py_DECREF(coerced1);
1004 Py_DECREF(coerced2);
1007 goto exit_inplace_result_object;
1012 Py_DECREF(coerced1);
1013 Py_DECREF(coerced2);
1017 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1020 PyObject *coerced1 = *operand1;
1021 PyObject *coerced2 = operand2;
1023 int err = c2(&coerced2, &coerced1);
1025 if (unlikely(err < 0)) {
1026 goto exit_inplace_exception;
1030 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1032 if (likely(mv == NULL)) {
1033 binaryfunc slot = mv->nb_divide;
1035 if (likely(slot != NULL)) {
1036 PyObject *x = slot(coerced1, coerced2);
1038 Py_DECREF(coerced1);
1039 Py_DECREF(coerced2);
1042 goto exit_inplace_result_object;
1047 Py_DECREF(coerced1);
1048 Py_DECREF(coerced2);
1054#if PYTHON_VERSION < 0x300
1055 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'long' and '%s'", type2->tp_name);
1057 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'int' and '%s'", type2->tp_name);
1059 goto exit_inplace_exception;
1062exit_inplace_result_object:
1063 if (unlikely(obj_result == NULL)) {
1068 Py_DECREF(*operand1);
1072 *operand1 = obj_result;
1076exit_inplace_exception:
1079static inline bool _INPLACE_OPERATION_OLDDIV_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1082 CHECK_OBJECT(*operand1);
1083 assert(PyLong_CheckExact(*operand1));
1084 CHECK_OBJECT(operand2);
1086 PyTypeObject *type2 = Py_TYPE(operand2);
1088 if (&PyLong_Type == type2) {
1092#if defined(_MSC_VER)
1093#pragma warning(push)
1094#pragma warning(disable : 4101)
1096 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1097 NUITKA_MAY_BE_UNUSED
long clong_result;
1098#if defined(_MSC_VER)
1102 PyObject *x = PyLong_Type.tp_as_number->nb_divide(*operand1, operand2);
1103 assert(x != Py_NotImplemented);
1106 goto exit_result_object;
1109 if (unlikely(obj_result == NULL)) {
1110 goto exit_result_exception;
1113 Py_DECREF(*operand1);
1114 *operand1 = obj_result;
1115 goto exit_result_ok;
1120 exit_result_exception:
1124 return __INPLACE_OPERATION_OLDDIV_LONG_OBJECT(operand1, operand2);
1127bool INPLACE_OPERATION_OLDDIV_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1128 return _INPLACE_OPERATION_OLDDIV_LONG_OBJECT(operand1, operand2);
1132#if PYTHON_VERSION < 0x300
1134static inline bool _INPLACE_OPERATION_OLDDIV_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1137 CHECK_OBJECT(*operand1);
1138 assert(PyFloat_CheckExact(*operand1));
1139 CHECK_OBJECT(operand2);
1140 assert(PyFloat_CheckExact(operand2));
1142#if defined(_MSC_VER)
1143#pragma warning(push)
1144#pragma warning(disable : 4101)
1147 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1148 NUITKA_MAY_BE_UNUSED
long clong_result;
1149 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1150#if defined(_MSC_VER)
1154 CHECK_OBJECT(*operand1);
1155 assert(PyFloat_CheckExact(*operand1));
1156 CHECK_OBJECT(operand2);
1157 assert(PyFloat_CheckExact(operand2));
1159 const double a = PyFloat_AS_DOUBLE(*operand1);
1160 const double b = PyFloat_AS_DOUBLE(operand2);
1162 if (unlikely(b == 0.0)) {
1163 PyThreadState *tstate = PyThreadState_GET();
1165 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
1166 goto exit_result_exception;
1173 goto exit_result_ok_cfloat;
1176exit_result_ok_cfloat:
1177 if (Py_REFCNT(*operand1) == 1) {
1178 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1181 Py_DECREF(*operand1);
1183 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1185 goto exit_result_ok;
1190exit_result_exception:
1194bool INPLACE_OPERATION_OLDDIV_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1195 return _INPLACE_OPERATION_OLDDIV_FLOAT_FLOAT(operand1, operand2);
1199#if PYTHON_VERSION < 0x300
1201static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_OLDDIV_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1202 PyTypeObject *type1 = Py_TYPE(*operand1);
1204#if defined(_MSC_VER)
1205#pragma warning(push)
1206#pragma warning(disable : 4101)
1208 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1209 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1210#if defined(_MSC_VER)
1215 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_divide : NULL;
1217 if (islot != NULL) {
1218 PyObject *x = islot(*operand1, operand2);
1220 if (x != Py_NotImplemented) {
1222 goto exit_inplace_result_object;
1225 Py_DECREF_IMMORTAL(x);
1230 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
1231 binaryfunc slot2 = NULL;
1233 if (!(type1 == &PyFloat_Type)) {
1236 slot2 = PyFloat_Type.tp_as_number->nb_divide;
1238 if (slot1 == slot2) {
1243 if (slot1 != NULL) {
1244 PyObject *x = slot1(*operand1, operand2);
1246 if (x != Py_NotImplemented) {
1248 goto exit_inplace_result_object;
1251 Py_DECREF_IMMORTAL(x);
1254 if (slot2 != NULL) {
1255 PyObject *x = slot2(*operand1, operand2);
1257 if (x != Py_NotImplemented) {
1259 goto exit_inplace_result_object;
1262 Py_DECREF_IMMORTAL(x);
1265#if PYTHON_VERSION < 0x300
1266 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1268 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1271 PyObject *coerced1 = *operand1;
1272 PyObject *coerced2 = operand2;
1274 int err = c1(&coerced1, &coerced2);
1276 if (unlikely(err < 0)) {
1277 goto exit_inplace_exception;
1281 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1283 if (likely(mv == NULL)) {
1284 binaryfunc slot = mv->nb_divide;
1286 if (likely(slot != NULL)) {
1287 PyObject *x = slot(coerced1, coerced2);
1289 Py_DECREF(coerced1);
1290 Py_DECREF(coerced2);
1293 goto exit_inplace_result_object;
1298 Py_DECREF(coerced1);
1299 Py_DECREF(coerced2);
1302 coercion c2 = PyFloat_Type.tp_as_number->nb_coerce;
1305 PyObject *coerced1 = *operand1;
1306 PyObject *coerced2 = operand2;
1308 int err = c2(&coerced2, &coerced1);
1310 if (unlikely(err < 0)) {
1311 goto exit_inplace_exception;
1315 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1317 if (likely(mv == NULL)) {
1318 binaryfunc slot = mv->nb_divide;
1320 if (likely(slot != NULL)) {
1321 PyObject *x = slot(coerced1, coerced2);
1323 Py_DECREF(coerced1);
1324 Py_DECREF(coerced2);
1327 goto exit_inplace_result_object;
1332 Py_DECREF(coerced1);
1333 Py_DECREF(coerced2);
1339 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: '%s' and 'float'", type1->tp_name);
1340 goto exit_inplace_exception;
1343exit_inplace_result_object:
1344 if (unlikely(obj_result == NULL)) {
1349 Py_DECREF(*operand1);
1353 *operand1 = obj_result;
1357exit_inplace_exception:
1360static inline bool _INPLACE_OPERATION_OLDDIV_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1363 CHECK_OBJECT(*operand1);
1364 CHECK_OBJECT(operand2);
1365 assert(PyFloat_CheckExact(operand2));
1367 PyTypeObject *type1 = Py_TYPE(*operand1);
1369 if (type1 == &PyFloat_Type) {
1372#if defined(_MSC_VER)
1373#pragma warning(push)
1374#pragma warning(disable : 4101)
1377 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1378 NUITKA_MAY_BE_UNUSED
long clong_result;
1379 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1380#if defined(_MSC_VER)
1384 CHECK_OBJECT(*operand1);
1385 assert(PyFloat_CheckExact(*operand1));
1386 CHECK_OBJECT(operand2);
1387 assert(PyFloat_CheckExact(operand2));
1389 const double a = PyFloat_AS_DOUBLE(*operand1);
1390 const double b = PyFloat_AS_DOUBLE(operand2);
1392 if (unlikely(b == 0.0)) {
1393 PyThreadState *tstate = PyThreadState_GET();
1395 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
1396 goto exit_result_exception;
1403 goto exit_result_ok_cfloat;
1406 exit_result_ok_cfloat:
1407 if (Py_REFCNT(*operand1) == 1) {
1408 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1411 Py_DECREF(*operand1);
1413 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1415 goto exit_result_ok;
1420 exit_result_exception:
1424 return __INPLACE_OPERATION_OLDDIV_OBJECT_FLOAT(operand1, operand2);
1427bool INPLACE_OPERATION_OLDDIV_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1428 return _INPLACE_OPERATION_OLDDIV_OBJECT_FLOAT(operand1, operand2);
1432#if PYTHON_VERSION < 0x300
1434static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_OLDDIV_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1435 PyTypeObject *type2 = Py_TYPE(operand2);
1437#if defined(_MSC_VER)
1438#pragma warning(push)
1439#pragma warning(disable : 4101)
1441 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1442 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1443#if defined(_MSC_VER)
1450 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_divide;
1451 binaryfunc slot2 = NULL;
1453 if (!(&PyFloat_Type == type2)) {
1457 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_divide : NULL;
1459 if (slot1 == slot2) {
1464 if (slot1 != NULL) {
1465 if (slot2 != NULL) {
1466 if (Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
1467 PyObject *x = slot2(*operand1, operand2);
1469 if (x != Py_NotImplemented) {
1471 goto exit_inplace_result_object;
1474 Py_DECREF_IMMORTAL(x);
1479 PyObject *x = slot1(*operand1, operand2);
1481 if (x != Py_NotImplemented) {
1483 goto exit_inplace_result_object;
1486 Py_DECREF_IMMORTAL(x);
1489 if (slot2 != NULL) {
1490 PyObject *x = slot2(*operand1, operand2);
1492 if (x != Py_NotImplemented) {
1494 goto exit_inplace_result_object;
1497 Py_DECREF_IMMORTAL(x);
1500#if PYTHON_VERSION < 0x300
1501 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1502 coercion c1 = PyFloat_Type.tp_as_number->nb_coerce;
1505 PyObject *coerced1 = *operand1;
1506 PyObject *coerced2 = operand2;
1508 int err = c1(&coerced1, &coerced2);
1510 if (unlikely(err < 0)) {
1511 goto exit_inplace_exception;
1515 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1517 if (likely(mv == NULL)) {
1518 binaryfunc slot = mv->nb_divide;
1520 if (likely(slot != NULL)) {
1521 PyObject *x = slot(coerced1, coerced2);
1523 Py_DECREF(coerced1);
1524 Py_DECREF(coerced2);
1527 goto exit_inplace_result_object;
1532 Py_DECREF(coerced1);
1533 Py_DECREF(coerced2);
1537 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1540 PyObject *coerced1 = *operand1;
1541 PyObject *coerced2 = operand2;
1543 int err = c2(&coerced2, &coerced1);
1545 if (unlikely(err < 0)) {
1546 goto exit_inplace_exception;
1550 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1552 if (likely(mv == NULL)) {
1553 binaryfunc slot = mv->nb_divide;
1555 if (likely(slot != NULL)) {
1556 PyObject *x = slot(coerced1, coerced2);
1558 Py_DECREF(coerced1);
1559 Py_DECREF(coerced2);
1562 goto exit_inplace_result_object;
1567 Py_DECREF(coerced1);
1568 Py_DECREF(coerced2);
1574 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'float' and '%s'", type2->tp_name);
1575 goto exit_inplace_exception;
1578exit_inplace_result_object:
1579 if (unlikely(obj_result == NULL)) {
1584 Py_DECREF(*operand1);
1588 *operand1 = obj_result;
1592exit_inplace_exception:
1595static inline bool _INPLACE_OPERATION_OLDDIV_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1598 CHECK_OBJECT(*operand1);
1599 assert(PyFloat_CheckExact(*operand1));
1600 CHECK_OBJECT(operand2);
1602 PyTypeObject *type2 = Py_TYPE(operand2);
1604 if (&PyFloat_Type == type2) {
1607#if defined(_MSC_VER)
1608#pragma warning(push)
1609#pragma warning(disable : 4101)
1612 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1613 NUITKA_MAY_BE_UNUSED
long clong_result;
1614 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1615#if defined(_MSC_VER)
1619 CHECK_OBJECT(*operand1);
1620 assert(PyFloat_CheckExact(*operand1));
1621 CHECK_OBJECT(operand2);
1622 assert(PyFloat_CheckExact(operand2));
1624 const double a = PyFloat_AS_DOUBLE(*operand1);
1625 const double b = PyFloat_AS_DOUBLE(operand2);
1627 if (unlikely(b == 0.0)) {
1628 PyThreadState *tstate = PyThreadState_GET();
1630 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
1631 goto exit_result_exception;
1638 goto exit_result_ok_cfloat;
1641 exit_result_ok_cfloat:
1642 if (Py_REFCNT(*operand1) == 1) {
1643 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1646 Py_DECREF(*operand1);
1648 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1650 goto exit_result_ok;
1655 exit_result_exception:
1659 return __INPLACE_OPERATION_OLDDIV_FLOAT_OBJECT(operand1, operand2);
1662bool INPLACE_OPERATION_OLDDIV_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1663 return _INPLACE_OPERATION_OLDDIV_FLOAT_OBJECT(operand1, operand2);
1667#if PYTHON_VERSION < 0x300
1669static inline bool _INPLACE_OPERATION_OLDDIV_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1672 CHECK_OBJECT(*operand1);
1673 assert(PyFloat_CheckExact(*operand1));
1674 CHECK_OBJECT(operand2);
1675 assert(PyLong_CheckExact(operand2));
1677#if defined(_MSC_VER)
1678#pragma warning(push)
1679#pragma warning(disable : 4101)
1681 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1682 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1683#if defined(_MSC_VER)
1690 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_divide;
1693 if (slot1 != NULL) {
1694 PyObject *x = slot1(*operand1, operand2);
1696 if (x != Py_NotImplemented) {
1698 goto exit_inplace_result_object;
1701 Py_DECREF_IMMORTAL(x);
1706#if PYTHON_VERSION < 0x300
1707 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'float' and 'long'");
1709 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'float' and 'int'");
1711 goto exit_inplace_exception;
1714exit_inplace_result_object:
1715 if (unlikely(obj_result == NULL)) {
1720 Py_DECREF(*operand1);
1724 *operand1 = obj_result;
1728exit_inplace_exception:
1732bool INPLACE_OPERATION_OLDDIV_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1733 return _INPLACE_OPERATION_OLDDIV_FLOAT_LONG(operand1, operand2);
1737#if PYTHON_VERSION < 0x300
1739static inline bool _INPLACE_OPERATION_OLDDIV_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
1742 CHECK_OBJECT(*operand1);
1743 assert(PyLong_CheckExact(*operand1));
1744 CHECK_OBJECT(operand2);
1745 assert(PyFloat_CheckExact(operand2));
1747#if defined(_MSC_VER)
1748#pragma warning(push)
1749#pragma warning(disable : 4101)
1751 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1752 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1753#if defined(_MSC_VER)
1761 binaryfunc slot2 = NULL;
1766 slot2 = PyFloat_Type.tp_as_number->nb_divide;
1769 if (slot2 != NULL) {
1770 PyObject *x = slot2(*operand1, operand2);
1772 if (x != Py_NotImplemented) {
1774 goto exit_inplace_result_object;
1777 Py_DECREF_IMMORTAL(x);
1782#if PYTHON_VERSION < 0x300
1783 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'long' and 'float'");
1785 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'int' and 'float'");
1787 goto exit_inplace_exception;
1790exit_inplace_result_object:
1791 if (unlikely(obj_result == NULL)) {
1796 Py_DECREF(*operand1);
1800 *operand1 = obj_result;
1804exit_inplace_exception:
1808bool INPLACE_OPERATION_OLDDIV_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
1809 return _INPLACE_OPERATION_OLDDIV_LONG_FLOAT(operand1, operand2);
1813#if PYTHON_VERSION < 0x300
1815static inline bool _INPLACE_OPERATION_OLDDIV_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
1818 CHECK_OBJECT(*operand1);
1819 assert(PyFloat_CheckExact(*operand1));
1820 CHECK_OBJECT(operand2);
1821 assert(PyInt_CheckExact(operand2));
1823#if defined(_MSC_VER)
1824#pragma warning(push)
1825#pragma warning(disable : 4101)
1827 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1828 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1829#if defined(_MSC_VER)
1836 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_divide;
1839 if (slot1 != NULL) {
1840 PyObject *x = slot1(*operand1, operand2);
1842 if (x != Py_NotImplemented) {
1844 goto exit_inplace_result_object;
1847 Py_DECREF_IMMORTAL(x);
1852 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'float' and 'int'");
1853 goto exit_inplace_exception;
1856exit_inplace_result_object:
1857 if (unlikely(obj_result == NULL)) {
1862 Py_DECREF(*operand1);
1866 *operand1 = obj_result;
1870exit_inplace_exception:
1874bool INPLACE_OPERATION_OLDDIV_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
1875 return _INPLACE_OPERATION_OLDDIV_FLOAT_INT(operand1, operand2);
1879#if PYTHON_VERSION < 0x300
1881static inline bool _INPLACE_OPERATION_OLDDIV_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
1884 CHECK_OBJECT(*operand1);
1885 assert(PyInt_CheckExact(*operand1));
1886 CHECK_OBJECT(operand2);
1887 assert(PyFloat_CheckExact(operand2));
1889#if defined(_MSC_VER)
1890#pragma warning(push)
1891#pragma warning(disable : 4101)
1893 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1894 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1895#if defined(_MSC_VER)
1903 binaryfunc slot2 = NULL;
1908 slot2 = PyFloat_Type.tp_as_number->nb_divide;
1911 if (slot2 != NULL) {
1912 PyObject *x = slot2(*operand1, operand2);
1914 if (x != Py_NotImplemented) {
1916 goto exit_inplace_result_object;
1919 Py_DECREF_IMMORTAL(x);
1924 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'int' and 'float'");
1925 goto exit_inplace_exception;
1928exit_inplace_result_object:
1929 if (unlikely(obj_result == NULL)) {
1934 Py_DECREF(*operand1);
1938 *operand1 = obj_result;
1942exit_inplace_exception:
1946bool INPLACE_OPERATION_OLDDIV_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
1947 return _INPLACE_OPERATION_OLDDIV_INT_FLOAT(operand1, operand2);
1951#if PYTHON_VERSION < 0x300
1953static inline bool _INPLACE_OPERATION_OLDDIV_LONG_INT(PyObject **operand1, PyObject *operand2) {
1956 CHECK_OBJECT(*operand1);
1957 assert(PyLong_CheckExact(*operand1));
1958 CHECK_OBJECT(operand2);
1959 assert(PyInt_CheckExact(operand2));
1961#if defined(_MSC_VER)
1962#pragma warning(push)
1963#pragma warning(disable : 4101)
1965 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1966 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1967#if defined(_MSC_VER)
1974 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_divide;
1977 if (slot1 != NULL) {
1978 PyObject *x = slot1(*operand1, operand2);
1980 if (x != Py_NotImplemented) {
1982 goto exit_inplace_result_object;
1985 Py_DECREF_IMMORTAL(x);
1990 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'long' and 'int'");
1991 goto exit_inplace_exception;
1994exit_inplace_result_object:
1995 if (unlikely(obj_result == NULL)) {
2000 Py_DECREF(*operand1);
2004 *operand1 = obj_result;
2008exit_inplace_exception:
2012bool INPLACE_OPERATION_OLDDIV_LONG_INT(PyObject **operand1, PyObject *operand2) {
2013 return _INPLACE_OPERATION_OLDDIV_LONG_INT(operand1, operand2);
2017#if PYTHON_VERSION < 0x300
2019static inline bool _INPLACE_OPERATION_OLDDIV_INT_LONG(PyObject **operand1, PyObject *operand2) {
2022 CHECK_OBJECT(*operand1);
2023 assert(PyInt_CheckExact(*operand1));
2024 CHECK_OBJECT(operand2);
2025 assert(PyLong_CheckExact(operand2));
2027#if defined(_MSC_VER)
2028#pragma warning(push)
2029#pragma warning(disable : 4101)
2031 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2032 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2033#if defined(_MSC_VER)
2041 binaryfunc slot2 = NULL;
2046 slot2 = PyLong_Type.tp_as_number->nb_divide;
2049 if (slot2 != NULL) {
2050 PyObject *x = slot2(*operand1, operand2);
2052 if (x != Py_NotImplemented) {
2054 goto exit_inplace_result_object;
2057 Py_DECREF_IMMORTAL(x);
2062 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'int' and 'long'");
2063 goto exit_inplace_exception;
2066exit_inplace_result_object:
2067 if (unlikely(obj_result == NULL)) {
2072 Py_DECREF(*operand1);
2076 *operand1 = obj_result;
2080exit_inplace_exception:
2084bool INPLACE_OPERATION_OLDDIV_INT_LONG(PyObject **operand1, PyObject *operand2) {
2085 return _INPLACE_OPERATION_OLDDIV_INT_LONG(operand1, operand2);
2089#if PYTHON_VERSION < 0x300
2091static inline bool _INPLACE_OPERATION_OLDDIV_INT_CLONG(PyObject **operand1,
long operand2) {
2094 CHECK_OBJECT(*operand1);
2095 assert(PyInt_CheckExact(*operand1));
2098#if defined(_MSC_VER)
2099#pragma warning(push)
2100#pragma warning(disable : 4101)
2102 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2103 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2104 NUITKA_MAY_BE_UNUSED
long clong_result;
2105 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2106#if defined(_MSC_VER)
2110 CHECK_OBJECT(*operand1);
2111 assert(PyInt_CheckExact(*operand1));
2113 const long a = PyInt_AS_LONG(*operand1);
2114 const long b = operand2;
2116 if (unlikely(b == 0)) {
2117 PyThreadState *tstate = PyThreadState_GET();
2119 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"integer division or modulo by zero");
2120 goto exit_result_exception;
2129 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
2130 long a_div_b = a / b;
2131 long a_mod_b = (long)(a - (
unsigned long)a_div_b * b);
2133 if (a_mod_b && (b ^ a_mod_b) < 0) {
2138 clong_result = a_div_b;
2139 goto exit_result_ok_clong;
2143 PyObject *operand1_object = *operand1;
2144 PyObject *operand2_object = Nuitka_PyLong_FromLong(operand2);
2146 PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
2147 assert(r != Py_NotImplemented);
2149 Py_DECREF(operand2_object);
2152 goto exit_result_object;
2155exit_result_ok_clong:
2158 Py_DECREF(*operand1);
2162 *operand1 = Nuitka_PyInt_FromLong(clong_result);
2163 goto exit_result_ok;
2166 if (unlikely(obj_result == NULL)) {
2167 goto exit_result_exception;
2170 Py_DECREF(*operand1);
2172 *operand1 = obj_result;
2173 goto exit_result_ok;
2178exit_result_exception:
2182bool INPLACE_OPERATION_OLDDIV_INT_CLONG(PyObject **operand1,
long operand2) {
2183 return _INPLACE_OPERATION_OLDDIV_INT_CLONG(operand1, operand2);
2187#if PYTHON_VERSION < 0x300
2189static inline bool _INPLACE_OPERATION_OLDDIV_FLOAT_CFLOAT(PyObject **operand1,
double operand2) {
2192 CHECK_OBJECT(*operand1);
2193 assert(PyFloat_CheckExact(*operand1));
2195#if defined(_MSC_VER)
2196#pragma warning(push)
2197#pragma warning(disable : 4101)
2200 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2201 NUITKA_MAY_BE_UNUSED
long clong_result;
2202 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2203#if defined(_MSC_VER)
2207 CHECK_OBJECT(*operand1);
2208 assert(PyFloat_CheckExact(*operand1));
2210 const double a = PyFloat_AS_DOUBLE(*operand1);
2211 const double b = operand2;
2213 if (unlikely(b == 0.0)) {
2214 PyThreadState *tstate = PyThreadState_GET();
2216 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
2217 goto exit_result_exception;
2224 goto exit_result_ok_cfloat;
2227exit_result_ok_cfloat:
2228 if (Py_REFCNT(*operand1) == 1) {
2229 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
2232 Py_DECREF(*operand1);
2234 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2236 goto exit_result_ok;
2241exit_result_exception:
2245bool INPLACE_OPERATION_OLDDIV_FLOAT_CFLOAT(PyObject **operand1,
double operand2) {
2246 return _INPLACE_OPERATION_OLDDIV_FLOAT_CFLOAT(operand1, operand2);
2250#if PYTHON_VERSION < 0x300
2252static inline bool _INPLACE_OPERATION_OLDDIV_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
2255 CHECK_OBJECT(*operand1);
2256 CHECK_OBJECT(operand2);
2258#if PYTHON_VERSION < 0x300
2259 if (PyInt_CheckExact(*operand1) && PyInt_CheckExact(operand2)) {
2262#if defined(_MSC_VER)
2263#pragma warning(push)
2264#pragma warning(disable : 4101)
2266 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2267 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2268 NUITKA_MAY_BE_UNUSED
long clong_result;
2269 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2270#if defined(_MSC_VER)
2274 CHECK_OBJECT(*operand1);
2275 assert(PyInt_CheckExact(*operand1));
2276 CHECK_OBJECT(operand2);
2277 assert(PyInt_CheckExact(operand2));
2279 const long a = PyInt_AS_LONG(*operand1);
2280 const long b = PyInt_AS_LONG(operand2);
2282 if (unlikely(b == 0)) {
2283 PyThreadState *tstate = PyThreadState_GET();
2285 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"integer division or modulo by zero");
2286 goto exit_result_exception;
2295 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
2296 long a_div_b = a / b;
2297 long a_mod_b = (long)(a - (
unsigned long)a_div_b * b);
2299 if (a_mod_b && (b ^ a_mod_b) < 0) {
2304 clong_result = a_div_b;
2305 goto exit_result_ok_clong;
2309 PyObject *operand1_object = *operand1;
2310 PyObject *operand2_object = operand2;
2312 PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
2313 assert(r != Py_NotImplemented);
2316 goto exit_result_object;
2319 exit_result_ok_clong:
2322 Py_DECREF(*operand1);
2326 *operand1 = Nuitka_PyInt_FromLong(clong_result);
2327 goto exit_result_ok;
2330 if (unlikely(obj_result == NULL)) {
2331 goto exit_result_exception;
2334 Py_DECREF(*operand1);
2336 *operand1 = obj_result;
2337 goto exit_result_ok;
2342 exit_result_exception:
2347 if (Py_TYPE(*operand1) == Py_TYPE(operand2)) {
2348 if (PyFloat_CheckExact(operand2)) {
2349 return _INPLACE_OPERATION_OLDDIV_FLOAT_FLOAT(operand1, operand2);
2351#if PYTHON_VERSION >= 0x300
2352 if (PyLong_CheckExact(operand2)) {
2353 return _INPLACE_OPERATION_OLDDIV_LONG_LONG(operand1, operand2);
2358 PyTypeObject *type1 = Py_TYPE(*operand1);
2359 PyTypeObject *type2 = Py_TYPE(operand2);
2361#if defined(_MSC_VER)
2362#pragma warning(push)
2363#pragma warning(disable : 4101)
2365 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2366 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2367#if defined(_MSC_VER)
2372 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_divide : NULL;
2374 if (islot != NULL) {
2375 PyObject *x = islot(*operand1, operand2);
2377 if (x != Py_NotImplemented) {
2379 goto exit_inplace_result_object;
2382 Py_DECREF_IMMORTAL(x);
2387 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
2388 binaryfunc slot2 = NULL;
2390 if (!(type1 == type2)) {
2394 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_divide : NULL;
2396 if (slot1 == slot2) {
2401 if (slot1 != NULL) {
2402 if (slot2 != NULL) {
2403 if (Nuitka_Type_IsSubtype(type2, type1)) {
2404 PyObject *x = slot2(*operand1, operand2);
2406 if (x != Py_NotImplemented) {
2408 goto exit_inplace_result_object;
2411 Py_DECREF_IMMORTAL(x);
2416 PyObject *x = slot1(*operand1, operand2);
2418 if (x != Py_NotImplemented) {
2420 goto exit_inplace_result_object;
2423 Py_DECREF_IMMORTAL(x);
2426 if (slot2 != NULL) {
2427 PyObject *x = slot2(*operand1, operand2);
2429 if (x != Py_NotImplemented) {
2431 goto exit_inplace_result_object;
2434 Py_DECREF_IMMORTAL(x);
2437#if PYTHON_VERSION < 0x300
2438 if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
2440 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
2443 PyObject *coerced1 = *operand1;
2444 PyObject *coerced2 = operand2;
2446 int err = c1(&coerced1, &coerced2);
2448 if (unlikely(err < 0)) {
2449 goto exit_inplace_exception;
2453 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2455 if (likely(mv == NULL)) {
2456 binaryfunc slot = mv->nb_divide;
2458 if (likely(slot != NULL)) {
2459 PyObject *x = slot(coerced1, coerced2);
2461 Py_DECREF(coerced1);
2462 Py_DECREF(coerced2);
2465 goto exit_inplace_result_object;
2470 Py_DECREF(coerced1);
2471 Py_DECREF(coerced2);
2475 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2478 PyObject *coerced1 = *operand1;
2479 PyObject *coerced2 = operand2;
2481 int err = c2(&coerced2, &coerced1);
2483 if (unlikely(err < 0)) {
2484 goto exit_inplace_exception;
2488 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2490 if (likely(mv == NULL)) {
2491 binaryfunc slot = mv->nb_divide;
2493 if (likely(slot != NULL)) {
2494 PyObject *x = slot(coerced1, coerced2);
2496 Py_DECREF(coerced1);
2497 Py_DECREF(coerced2);
2500 goto exit_inplace_result_object;
2505 Py_DECREF(coerced1);
2506 Py_DECREF(coerced2);
2512 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: '%s' and '%s'", type1->tp_name,
2514 goto exit_inplace_exception;
2517exit_inplace_result_object:
2518 if (unlikely(obj_result == NULL)) {
2523 Py_DECREF(*operand1);
2527 *operand1 = obj_result;
2531exit_inplace_exception:
2535bool INPLACE_OPERATION_OLDDIV_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
2536 return _INPLACE_OPERATION_OLDDIV_OBJECT_OBJECT(operand1, operand2);