7#include "nuitka/prelude.h"
12#if PYTHON_VERSION < 0x300
14static inline bool _INPLACE_OPERATION_TRUEDIV_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,
"division by zero");
47 goto exit_result_exception;
52 goto exit_result_ok_const_float_minus_0_0;
54 goto exit_result_ok_const_float_0_0;
61#if DBL_MANT_DIG < WIDTH_OF_ULONG
62 if ((a >= 0 ? 0UL + a : 0UL - a) >> DBL_MANT_DIG || (b >= 0 ? 0UL + b : 0UL - b) >> DBL_MANT_DIG) {
66 double r = (double)a / (
double)b;
69 goto exit_result_ok_cfloat;
73 PyObject *operand1_object = *operand1;
74 PyObject *operand2_object = operand2;
76 PyObject *r = PyLong_Type.tp_as_number->nb_true_divide(operand1_object, operand2_object);
77 assert(r != Py_NotImplemented);
80 goto exit_result_object;
88 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
92 if (unlikely(obj_result == NULL)) {
93 goto exit_result_exception;
98 *operand1 = obj_result;
101exit_result_ok_const_float_0_0:
103 Py_DECREF(*operand1);
104 Py_INCREF(const_float_0_0);
105 *operand1 = const_float_0_0;
108exit_result_ok_const_float_minus_0_0:
110 Py_DECREF(*operand1);
111 Py_INCREF(const_float_minus_0_0);
112 *operand1 = const_float_minus_0_0;
118exit_result_exception:
122bool INPLACE_OPERATION_TRUEDIV_INT_INT(PyObject **operand1, PyObject *operand2) {
123 return _INPLACE_OPERATION_TRUEDIV_INT_INT(operand1, operand2);
127#if PYTHON_VERSION < 0x300
129static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_TRUEDIV_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
130 PyTypeObject *type1 = Py_TYPE(*operand1);
134#pragma warning(disable : 4101)
136 NUITKA_MAY_BE_UNUSED
bool cbool_result;
137 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
142 binaryfunc islot = (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1))
143 ? type1->tp_as_number->nb_inplace_true_divide
147 PyObject *x = islot(*operand1, operand2);
149 if (x != Py_NotImplemented) {
151 goto exit_inplace_result_object;
154 Py_DECREF_IMMORTAL(x);
159 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
160 binaryfunc slot2 = NULL;
162 if (!(type1 == &PyInt_Type)) {
165 slot2 = PyInt_Type.tp_as_number->nb_true_divide;
167 if (slot1 == slot2) {
173 PyObject *x = slot1(*operand1, operand2);
175 if (x != Py_NotImplemented) {
177 goto exit_inplace_result_object;
180 Py_DECREF_IMMORTAL(x);
184 PyObject *x = slot2(*operand1, operand2);
186 if (x != Py_NotImplemented) {
188 goto exit_inplace_result_object;
191 Py_DECREF_IMMORTAL(x);
194#if PYTHON_VERSION < 0x300
195 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
197 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
200 PyObject *coerced1 = *operand1;
201 PyObject *coerced2 = operand2;
203 int err = c1(&coerced1, &coerced2);
205 if (unlikely(err < 0)) {
206 goto exit_inplace_exception;
210 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
212 if (likely(mv == NULL)) {
213 binaryfunc slot = mv->nb_true_divide;
215 if (likely(slot != NULL)) {
216 PyObject *x = slot(coerced1, coerced2);
222 goto exit_inplace_result_object;
231 coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
234 PyObject *coerced1 = *operand1;
235 PyObject *coerced2 = operand2;
237 int err = c2(&coerced2, &coerced1);
239 if (unlikely(err < 0)) {
240 goto exit_inplace_exception;
244 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
246 if (likely(mv == NULL)) {
247 binaryfunc slot = mv->nb_true_divide;
249 if (likely(slot != NULL)) {
250 PyObject *x = slot(coerced1, coerced2);
256 goto exit_inplace_result_object;
268 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: '%s' and 'int'", type1->tp_name);
269 goto exit_inplace_exception;
272exit_inplace_result_object:
273 if (unlikely(obj_result == NULL)) {
278 Py_DECREF(*operand1);
282 *operand1 = obj_result;
286exit_inplace_exception:
289static inline bool _INPLACE_OPERATION_TRUEDIV_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
292 CHECK_OBJECT(*operand1);
293 CHECK_OBJECT(operand2);
294 assert(PyInt_CheckExact(operand2));
296 PyTypeObject *type1 = Py_TYPE(*operand1);
298 if (type1 == &PyInt_Type) {
304#pragma warning(disable : 4101)
306 NUITKA_MAY_BE_UNUSED
bool cbool_result;
307 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
308 NUITKA_MAY_BE_UNUSED
long clong_result;
309 NUITKA_MAY_BE_UNUSED
double cfloat_result;
314 CHECK_OBJECT(*operand1);
315 assert(PyInt_CheckExact(*operand1));
316 CHECK_OBJECT(operand2);
317 assert(PyInt_CheckExact(operand2));
319 const long a = PyInt_AS_LONG(*operand1);
320 const long b = PyInt_AS_LONG(operand2);
322 if (unlikely(b == 0)) {
323 PyThreadState *tstate = PyThreadState_GET();
325 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"division by zero");
326 goto exit_result_exception;
331 goto exit_result_ok_const_float_minus_0_0;
333 goto exit_result_ok_const_float_0_0;
340#if DBL_MANT_DIG < WIDTH_OF_ULONG
341 if ((a >= 0 ? 0UL + a : 0UL - a) >> DBL_MANT_DIG || (b >= 0 ? 0UL + b : 0UL - b) >> DBL_MANT_DIG) {
345 double r = (double)a / (
double)b;
348 goto exit_result_ok_cfloat;
352 PyObject *operand1_object = *operand1;
353 PyObject *operand2_object = operand2;
355 PyObject *r = PyLong_Type.tp_as_number->nb_true_divide(operand1_object, operand2_object);
356 assert(r != Py_NotImplemented);
359 goto exit_result_object;
362 exit_result_ok_cfloat:
365 Py_DECREF(*operand1);
367 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
371 if (unlikely(obj_result == NULL)) {
372 goto exit_result_exception;
375 Py_DECREF(*operand1);
377 *operand1 = obj_result;
380 exit_result_ok_const_float_0_0:
382 Py_DECREF(*operand1);
383 Py_INCREF(const_float_0_0);
384 *operand1 = const_float_0_0;
387 exit_result_ok_const_float_minus_0_0:
389 Py_DECREF(*operand1);
390 Py_INCREF(const_float_minus_0_0);
391 *operand1 = const_float_minus_0_0;
397 exit_result_exception:
401 return __INPLACE_OPERATION_TRUEDIV_OBJECT_INT(operand1, operand2);
404bool INPLACE_OPERATION_TRUEDIV_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
405 return _INPLACE_OPERATION_TRUEDIV_OBJECT_INT(operand1, operand2);
409#if PYTHON_VERSION < 0x300
411static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_TRUEDIV_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
412 PyTypeObject *type2 = Py_TYPE(operand2);
416#pragma warning(disable : 4101)
418 NUITKA_MAY_BE_UNUSED
bool cbool_result;
419 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
427 binaryfunc slot1 = PyInt_Type.tp_as_number->nb_true_divide;
428 binaryfunc slot2 = NULL;
430 if (!(&PyInt_Type == type2)) {
433 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide
436 if (slot1 == slot2) {
443 if (Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
444 PyObject *x = slot2(*operand1, operand2);
446 if (x != Py_NotImplemented) {
448 goto exit_inplace_result_object;
451 Py_DECREF_IMMORTAL(x);
456 PyObject *x = slot1(*operand1, operand2);
458 if (x != Py_NotImplemented) {
460 goto exit_inplace_result_object;
463 Py_DECREF_IMMORTAL(x);
467 PyObject *x = slot2(*operand1, operand2);
469 if (x != Py_NotImplemented) {
471 goto exit_inplace_result_object;
474 Py_DECREF_IMMORTAL(x);
477#if PYTHON_VERSION < 0x300
478 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
479 coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
482 PyObject *coerced1 = *operand1;
483 PyObject *coerced2 = operand2;
485 int err = c1(&coerced1, &coerced2);
487 if (unlikely(err < 0)) {
488 goto exit_inplace_exception;
492 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
494 if (likely(mv == NULL)) {
495 binaryfunc slot = mv->nb_true_divide;
497 if (likely(slot != NULL)) {
498 PyObject *x = slot(coerced1, coerced2);
504 goto exit_inplace_result_object;
514 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
517 PyObject *coerced1 = *operand1;
518 PyObject *coerced2 = operand2;
520 int err = c2(&coerced2, &coerced1);
522 if (unlikely(err < 0)) {
523 goto exit_inplace_exception;
527 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
529 if (likely(mv == NULL)) {
530 binaryfunc slot = mv->nb_true_divide;
532 if (likely(slot != NULL)) {
533 PyObject *x = slot(coerced1, coerced2);
539 goto exit_inplace_result_object;
551 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'int' and '%s'", type2->tp_name);
552 goto exit_inplace_exception;
555exit_inplace_result_object:
556 if (unlikely(obj_result == NULL)) {
561 Py_DECREF(*operand1);
565 *operand1 = obj_result;
569exit_inplace_exception:
572static inline bool _INPLACE_OPERATION_TRUEDIV_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
575 CHECK_OBJECT(*operand1);
576 assert(PyInt_CheckExact(*operand1));
577 CHECK_OBJECT(operand2);
579 PyTypeObject *type2 = Py_TYPE(operand2);
581 if (&PyInt_Type == type2) {
587#pragma warning(disable : 4101)
589 NUITKA_MAY_BE_UNUSED
bool cbool_result;
590 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
591 NUITKA_MAY_BE_UNUSED
long clong_result;
592 NUITKA_MAY_BE_UNUSED
double cfloat_result;
597 CHECK_OBJECT(*operand1);
598 assert(PyInt_CheckExact(*operand1));
599 CHECK_OBJECT(operand2);
600 assert(PyInt_CheckExact(operand2));
602 const long a = PyInt_AS_LONG(*operand1);
603 const long b = PyInt_AS_LONG(operand2);
605 if (unlikely(b == 0)) {
606 PyThreadState *tstate = PyThreadState_GET();
608 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"division by zero");
609 goto exit_result_exception;
614 goto exit_result_ok_const_float_minus_0_0;
616 goto exit_result_ok_const_float_0_0;
623#if DBL_MANT_DIG < WIDTH_OF_ULONG
624 if ((a >= 0 ? 0UL + a : 0UL - a) >> DBL_MANT_DIG || (b >= 0 ? 0UL + b : 0UL - b) >> DBL_MANT_DIG) {
628 double r = (double)a / (
double)b;
631 goto exit_result_ok_cfloat;
635 PyObject *operand1_object = *operand1;
636 PyObject *operand2_object = operand2;
638 PyObject *r = PyLong_Type.tp_as_number->nb_true_divide(operand1_object, operand2_object);
639 assert(r != Py_NotImplemented);
642 goto exit_result_object;
645 exit_result_ok_cfloat:
648 Py_DECREF(*operand1);
650 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
654 if (unlikely(obj_result == NULL)) {
655 goto exit_result_exception;
658 Py_DECREF(*operand1);
660 *operand1 = obj_result;
663 exit_result_ok_const_float_0_0:
665 Py_DECREF(*operand1);
666 Py_INCREF(const_float_0_0);
667 *operand1 = const_float_0_0;
670 exit_result_ok_const_float_minus_0_0:
672 Py_DECREF(*operand1);
673 Py_INCREF(const_float_minus_0_0);
674 *operand1 = const_float_minus_0_0;
680 exit_result_exception:
684 return __INPLACE_OPERATION_TRUEDIV_INT_OBJECT(operand1, operand2);
687bool INPLACE_OPERATION_TRUEDIV_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
688 return _INPLACE_OPERATION_TRUEDIV_INT_OBJECT(operand1, operand2);
693static inline bool _INPLACE_OPERATION_TRUEDIV_LONG_LONG(PyObject **operand1, PyObject *operand2) {
696 CHECK_OBJECT(*operand1);
697 assert(PyLong_CheckExact(*operand1));
698 CHECK_OBJECT(operand2);
699 assert(PyLong_CheckExact(operand2));
704#pragma warning(disable : 4101)
706 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
707 NUITKA_MAY_BE_UNUSED
long clong_result;
712 PyObject *x = PyLong_Type.tp_as_number->nb_true_divide(*operand1, operand2);
713 assert(x != Py_NotImplemented);
716 goto exit_result_object;
719 if (unlikely(obj_result == NULL)) {
720 goto exit_result_exception;
723 Py_DECREF(*operand1);
724 *operand1 = obj_result;
730exit_result_exception:
734bool INPLACE_OPERATION_TRUEDIV_LONG_LONG(PyObject **operand1, PyObject *operand2) {
735 return _INPLACE_OPERATION_TRUEDIV_LONG_LONG(operand1, operand2);
739static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_TRUEDIV_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
740 PyTypeObject *type1 = Py_TYPE(*operand1);
744#pragma warning(disable : 4101)
746 NUITKA_MAY_BE_UNUSED
bool cbool_result;
747 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
752 binaryfunc islot = (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1))
753 ? type1->tp_as_number->nb_inplace_true_divide
757 PyObject *x = islot(*operand1, operand2);
759 if (x != Py_NotImplemented) {
761 goto exit_inplace_result_object;
764 Py_DECREF_IMMORTAL(x);
769 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
770 binaryfunc slot2 = NULL;
772 if (!(type1 == &PyLong_Type)) {
775 slot2 = PyLong_Type.tp_as_number->nb_true_divide;
777 if (slot1 == slot2) {
783 PyObject *x = slot1(*operand1, operand2);
785 if (x != Py_NotImplemented) {
787 goto exit_inplace_result_object;
790 Py_DECREF_IMMORTAL(x);
794 PyObject *x = slot2(*operand1, operand2);
796 if (x != Py_NotImplemented) {
798 goto exit_inplace_result_object;
801 Py_DECREF_IMMORTAL(x);
804#if PYTHON_VERSION < 0x300
805 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
807 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
810 PyObject *coerced1 = *operand1;
811 PyObject *coerced2 = operand2;
813 int err = c1(&coerced1, &coerced2);
815 if (unlikely(err < 0)) {
816 goto exit_inplace_exception;
820 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
822 if (likely(mv == NULL)) {
823 binaryfunc slot = mv->nb_true_divide;
825 if (likely(slot != NULL)) {
826 PyObject *x = slot(coerced1, coerced2);
832 goto exit_inplace_result_object;
841 coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
844 PyObject *coerced1 = *operand1;
845 PyObject *coerced2 = operand2;
847 int err = c2(&coerced2, &coerced1);
849 if (unlikely(err < 0)) {
850 goto exit_inplace_exception;
854 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
856 if (likely(mv == NULL)) {
857 binaryfunc slot = mv->nb_true_divide;
859 if (likely(slot != NULL)) {
860 PyObject *x = slot(coerced1, coerced2);
866 goto exit_inplace_result_object;
878#if PYTHON_VERSION < 0x300
879 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: '%s' and 'long'", type1->tp_name);
881 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: '%s' and 'int'", type1->tp_name);
883 goto exit_inplace_exception;
886exit_inplace_result_object:
887 if (unlikely(obj_result == NULL)) {
892 Py_DECREF(*operand1);
896 *operand1 = obj_result;
900exit_inplace_exception:
903static inline bool _INPLACE_OPERATION_TRUEDIV_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
906 CHECK_OBJECT(*operand1);
907 CHECK_OBJECT(operand2);
908 assert(PyLong_CheckExact(operand2));
910 PyTypeObject *type1 = Py_TYPE(*operand1);
912 if (type1 == &PyLong_Type) {
918#pragma warning(disable : 4101)
920 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
921 NUITKA_MAY_BE_UNUSED
long clong_result;
926 PyObject *x = PyLong_Type.tp_as_number->nb_true_divide(*operand1, operand2);
927 assert(x != Py_NotImplemented);
930 goto exit_result_object;
933 if (unlikely(obj_result == NULL)) {
934 goto exit_result_exception;
937 Py_DECREF(*operand1);
938 *operand1 = obj_result;
944 exit_result_exception:
948 return __INPLACE_OPERATION_TRUEDIV_OBJECT_LONG(operand1, operand2);
951bool INPLACE_OPERATION_TRUEDIV_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
952 return _INPLACE_OPERATION_TRUEDIV_OBJECT_LONG(operand1, operand2);
956static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_TRUEDIV_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
957 PyTypeObject *type2 = Py_TYPE(operand2);
961#pragma warning(disable : 4101)
963 NUITKA_MAY_BE_UNUSED
bool cbool_result;
964 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
972 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_true_divide;
973 binaryfunc slot2 = NULL;
975 if (!(&PyLong_Type == type2)) {
978 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide
981 if (slot1 == slot2) {
988 if (Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
989 PyObject *x = slot2(*operand1, operand2);
991 if (x != Py_NotImplemented) {
993 goto exit_inplace_result_object;
996 Py_DECREF_IMMORTAL(x);
1001 PyObject *x = slot1(*operand1, operand2);
1003 if (x != Py_NotImplemented) {
1005 goto exit_inplace_result_object;
1008 Py_DECREF_IMMORTAL(x);
1011 if (slot2 != NULL) {
1012 PyObject *x = slot2(*operand1, operand2);
1014 if (x != Py_NotImplemented) {
1016 goto exit_inplace_result_object;
1019 Py_DECREF_IMMORTAL(x);
1022#if PYTHON_VERSION < 0x300
1023 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1024 coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
1027 PyObject *coerced1 = *operand1;
1028 PyObject *coerced2 = operand2;
1030 int err = c1(&coerced1, &coerced2);
1032 if (unlikely(err < 0)) {
1033 goto exit_inplace_exception;
1037 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1039 if (likely(mv == NULL)) {
1040 binaryfunc slot = mv->nb_true_divide;
1042 if (likely(slot != NULL)) {
1043 PyObject *x = slot(coerced1, coerced2);
1045 Py_DECREF(coerced1);
1046 Py_DECREF(coerced2);
1049 goto exit_inplace_result_object;
1054 Py_DECREF(coerced1);
1055 Py_DECREF(coerced2);
1059 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1062 PyObject *coerced1 = *operand1;
1063 PyObject *coerced2 = operand2;
1065 int err = c2(&coerced2, &coerced1);
1067 if (unlikely(err < 0)) {
1068 goto exit_inplace_exception;
1072 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1074 if (likely(mv == NULL)) {
1075 binaryfunc slot = mv->nb_true_divide;
1077 if (likely(slot != NULL)) {
1078 PyObject *x = slot(coerced1, coerced2);
1080 Py_DECREF(coerced1);
1081 Py_DECREF(coerced2);
1084 goto exit_inplace_result_object;
1089 Py_DECREF(coerced1);
1090 Py_DECREF(coerced2);
1096#if PYTHON_VERSION < 0x300
1097 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'long' and '%s'", type2->tp_name);
1099 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'int' and '%s'", type2->tp_name);
1101 goto exit_inplace_exception;
1104exit_inplace_result_object:
1105 if (unlikely(obj_result == NULL)) {
1110 Py_DECREF(*operand1);
1114 *operand1 = obj_result;
1118exit_inplace_exception:
1121static inline bool _INPLACE_OPERATION_TRUEDIV_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1124 CHECK_OBJECT(*operand1);
1125 assert(PyLong_CheckExact(*operand1));
1126 CHECK_OBJECT(operand2);
1128 PyTypeObject *type2 = Py_TYPE(operand2);
1130 if (&PyLong_Type == type2) {
1134#if defined(_MSC_VER)
1135#pragma warning(push)
1136#pragma warning(disable : 4101)
1138 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1139 NUITKA_MAY_BE_UNUSED
long clong_result;
1140#if defined(_MSC_VER)
1144 PyObject *x = PyLong_Type.tp_as_number->nb_true_divide(*operand1, operand2);
1145 assert(x != Py_NotImplemented);
1148 goto exit_result_object;
1151 if (unlikely(obj_result == NULL)) {
1152 goto exit_result_exception;
1155 Py_DECREF(*operand1);
1156 *operand1 = obj_result;
1157 goto exit_result_ok;
1162 exit_result_exception:
1166 return __INPLACE_OPERATION_TRUEDIV_LONG_OBJECT(operand1, operand2);
1169bool INPLACE_OPERATION_TRUEDIV_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1170 return _INPLACE_OPERATION_TRUEDIV_LONG_OBJECT(operand1, operand2);
1174static inline bool _INPLACE_OPERATION_TRUEDIV_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1177 CHECK_OBJECT(*operand1);
1178 assert(PyFloat_CheckExact(*operand1));
1179 CHECK_OBJECT(operand2);
1180 assert(PyFloat_CheckExact(operand2));
1182#if defined(_MSC_VER)
1183#pragma warning(push)
1184#pragma warning(disable : 4101)
1187 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1188 NUITKA_MAY_BE_UNUSED
long clong_result;
1189 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1190#if defined(_MSC_VER)
1194 CHECK_OBJECT(*operand1);
1195 assert(PyFloat_CheckExact(*operand1));
1196 CHECK_OBJECT(operand2);
1197 assert(PyFloat_CheckExact(operand2));
1199 const double a = PyFloat_AS_DOUBLE(*operand1);
1200 const double b = PyFloat_AS_DOUBLE(operand2);
1202 if (unlikely(b == 0.0)) {
1203 PyThreadState *tstate = PyThreadState_GET();
1205 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
1206 goto exit_result_exception;
1213 goto exit_result_ok_cfloat;
1216exit_result_ok_cfloat:
1217 if (Py_REFCNT(*operand1) == 1) {
1218 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1221 Py_DECREF(*operand1);
1223 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1225 goto exit_result_ok;
1230exit_result_exception:
1234bool INPLACE_OPERATION_TRUEDIV_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1235 return _INPLACE_OPERATION_TRUEDIV_FLOAT_FLOAT(operand1, operand2);
1239static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_TRUEDIV_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1240 PyTypeObject *type1 = Py_TYPE(*operand1);
1242#if defined(_MSC_VER)
1243#pragma warning(push)
1244#pragma warning(disable : 4101)
1246 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1247 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1248#if defined(_MSC_VER)
1252 binaryfunc islot = (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1))
1253 ? type1->tp_as_number->nb_inplace_true_divide
1256 if (islot != NULL) {
1257 PyObject *x = islot(*operand1, operand2);
1259 if (x != Py_NotImplemented) {
1261 goto exit_inplace_result_object;
1264 Py_DECREF_IMMORTAL(x);
1269 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
1270 binaryfunc slot2 = NULL;
1272 if (!(type1 == &PyFloat_Type)) {
1275 slot2 = PyFloat_Type.tp_as_number->nb_true_divide;
1277 if (slot1 == slot2) {
1282 if (slot1 != NULL) {
1283 PyObject *x = slot1(*operand1, operand2);
1285 if (x != Py_NotImplemented) {
1287 goto exit_inplace_result_object;
1290 Py_DECREF_IMMORTAL(x);
1293 if (slot2 != NULL) {
1294 PyObject *x = slot2(*operand1, operand2);
1296 if (x != Py_NotImplemented) {
1298 goto exit_inplace_result_object;
1301 Py_DECREF_IMMORTAL(x);
1304#if PYTHON_VERSION < 0x300
1305 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1307 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1310 PyObject *coerced1 = *operand1;
1311 PyObject *coerced2 = operand2;
1313 int err = c1(&coerced1, &coerced2);
1315 if (unlikely(err < 0)) {
1316 goto exit_inplace_exception;
1320 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1322 if (likely(mv == NULL)) {
1323 binaryfunc slot = mv->nb_true_divide;
1325 if (likely(slot != NULL)) {
1326 PyObject *x = slot(coerced1, coerced2);
1328 Py_DECREF(coerced1);
1329 Py_DECREF(coerced2);
1332 goto exit_inplace_result_object;
1337 Py_DECREF(coerced1);
1338 Py_DECREF(coerced2);
1341 coercion c2 = PyFloat_Type.tp_as_number->nb_coerce;
1344 PyObject *coerced1 = *operand1;
1345 PyObject *coerced2 = operand2;
1347 int err = c2(&coerced2, &coerced1);
1349 if (unlikely(err < 0)) {
1350 goto exit_inplace_exception;
1354 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1356 if (likely(mv == NULL)) {
1357 binaryfunc slot = mv->nb_true_divide;
1359 if (likely(slot != NULL)) {
1360 PyObject *x = slot(coerced1, coerced2);
1362 Py_DECREF(coerced1);
1363 Py_DECREF(coerced2);
1366 goto exit_inplace_result_object;
1371 Py_DECREF(coerced1);
1372 Py_DECREF(coerced2);
1378 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: '%s' and 'float'", type1->tp_name);
1379 goto exit_inplace_exception;
1382exit_inplace_result_object:
1383 if (unlikely(obj_result == NULL)) {
1388 Py_DECREF(*operand1);
1392 *operand1 = obj_result;
1396exit_inplace_exception:
1399static inline bool _INPLACE_OPERATION_TRUEDIV_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1402 CHECK_OBJECT(*operand1);
1403 CHECK_OBJECT(operand2);
1404 assert(PyFloat_CheckExact(operand2));
1406 PyTypeObject *type1 = Py_TYPE(*operand1);
1408 if (type1 == &PyFloat_Type) {
1411#if defined(_MSC_VER)
1412#pragma warning(push)
1413#pragma warning(disable : 4101)
1416 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1417 NUITKA_MAY_BE_UNUSED
long clong_result;
1418 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1419#if defined(_MSC_VER)
1423 CHECK_OBJECT(*operand1);
1424 assert(PyFloat_CheckExact(*operand1));
1425 CHECK_OBJECT(operand2);
1426 assert(PyFloat_CheckExact(operand2));
1428 const double a = PyFloat_AS_DOUBLE(*operand1);
1429 const double b = PyFloat_AS_DOUBLE(operand2);
1431 if (unlikely(b == 0.0)) {
1432 PyThreadState *tstate = PyThreadState_GET();
1434 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
1435 goto exit_result_exception;
1442 goto exit_result_ok_cfloat;
1445 exit_result_ok_cfloat:
1446 if (Py_REFCNT(*operand1) == 1) {
1447 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1450 Py_DECREF(*operand1);
1452 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1454 goto exit_result_ok;
1459 exit_result_exception:
1463 return __INPLACE_OPERATION_TRUEDIV_OBJECT_FLOAT(operand1, operand2);
1466bool INPLACE_OPERATION_TRUEDIV_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1467 return _INPLACE_OPERATION_TRUEDIV_OBJECT_FLOAT(operand1, operand2);
1471static HEDLEY_NEVER_INLINE
bool __INPLACE_OPERATION_TRUEDIV_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1472 PyTypeObject *type2 = Py_TYPE(operand2);
1474#if defined(_MSC_VER)
1475#pragma warning(push)
1476#pragma warning(disable : 4101)
1478 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1479 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1480#if defined(_MSC_VER)
1487 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_true_divide;
1488 binaryfunc slot2 = NULL;
1490 if (!(&PyFloat_Type == type2)) {
1493 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide
1496 if (slot1 == slot2) {
1501 if (slot1 != NULL) {
1502 if (slot2 != NULL) {
1503 if (Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
1504 PyObject *x = slot2(*operand1, operand2);
1506 if (x != Py_NotImplemented) {
1508 goto exit_inplace_result_object;
1511 Py_DECREF_IMMORTAL(x);
1516 PyObject *x = slot1(*operand1, operand2);
1518 if (x != Py_NotImplemented) {
1520 goto exit_inplace_result_object;
1523 Py_DECREF_IMMORTAL(x);
1526 if (slot2 != NULL) {
1527 PyObject *x = slot2(*operand1, operand2);
1529 if (x != Py_NotImplemented) {
1531 goto exit_inplace_result_object;
1534 Py_DECREF_IMMORTAL(x);
1537#if PYTHON_VERSION < 0x300
1538 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1539 coercion c1 = PyFloat_Type.tp_as_number->nb_coerce;
1542 PyObject *coerced1 = *operand1;
1543 PyObject *coerced2 = operand2;
1545 int err = c1(&coerced1, &coerced2);
1547 if (unlikely(err < 0)) {
1548 goto exit_inplace_exception;
1552 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1554 if (likely(mv == NULL)) {
1555 binaryfunc slot = mv->nb_true_divide;
1557 if (likely(slot != NULL)) {
1558 PyObject *x = slot(coerced1, coerced2);
1560 Py_DECREF(coerced1);
1561 Py_DECREF(coerced2);
1564 goto exit_inplace_result_object;
1569 Py_DECREF(coerced1);
1570 Py_DECREF(coerced2);
1574 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1577 PyObject *coerced1 = *operand1;
1578 PyObject *coerced2 = operand2;
1580 int err = c2(&coerced2, &coerced1);
1582 if (unlikely(err < 0)) {
1583 goto exit_inplace_exception;
1587 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1589 if (likely(mv == NULL)) {
1590 binaryfunc slot = mv->nb_true_divide;
1592 if (likely(slot != NULL)) {
1593 PyObject *x = slot(coerced1, coerced2);
1595 Py_DECREF(coerced1);
1596 Py_DECREF(coerced2);
1599 goto exit_inplace_result_object;
1604 Py_DECREF(coerced1);
1605 Py_DECREF(coerced2);
1611 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'float' and '%s'", type2->tp_name);
1612 goto exit_inplace_exception;
1615exit_inplace_result_object:
1616 if (unlikely(obj_result == NULL)) {
1621 Py_DECREF(*operand1);
1625 *operand1 = obj_result;
1629exit_inplace_exception:
1632static inline bool _INPLACE_OPERATION_TRUEDIV_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1635 CHECK_OBJECT(*operand1);
1636 assert(PyFloat_CheckExact(*operand1));
1637 CHECK_OBJECT(operand2);
1639 PyTypeObject *type2 = Py_TYPE(operand2);
1641 if (&PyFloat_Type == type2) {
1644#if defined(_MSC_VER)
1645#pragma warning(push)
1646#pragma warning(disable : 4101)
1649 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1650 NUITKA_MAY_BE_UNUSED
long clong_result;
1651 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1652#if defined(_MSC_VER)
1656 CHECK_OBJECT(*operand1);
1657 assert(PyFloat_CheckExact(*operand1));
1658 CHECK_OBJECT(operand2);
1659 assert(PyFloat_CheckExact(operand2));
1661 const double a = PyFloat_AS_DOUBLE(*operand1);
1662 const double b = PyFloat_AS_DOUBLE(operand2);
1664 if (unlikely(b == 0.0)) {
1665 PyThreadState *tstate = PyThreadState_GET();
1667 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
1668 goto exit_result_exception;
1675 goto exit_result_ok_cfloat;
1678 exit_result_ok_cfloat:
1679 if (Py_REFCNT(*operand1) == 1) {
1680 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1683 Py_DECREF(*operand1);
1685 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1687 goto exit_result_ok;
1692 exit_result_exception:
1696 return __INPLACE_OPERATION_TRUEDIV_FLOAT_OBJECT(operand1, operand2);
1699bool INPLACE_OPERATION_TRUEDIV_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1700 return _INPLACE_OPERATION_TRUEDIV_FLOAT_OBJECT(operand1, operand2);
1704static inline bool _INPLACE_OPERATION_TRUEDIV_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1707 CHECK_OBJECT(*operand1);
1708 assert(PyFloat_CheckExact(*operand1));
1709 CHECK_OBJECT(operand2);
1710 assert(PyLong_CheckExact(operand2));
1712#if defined(_MSC_VER)
1713#pragma warning(push)
1714#pragma warning(disable : 4101)
1716 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1717 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1718#if defined(_MSC_VER)
1725 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_true_divide;
1728 if (slot1 != NULL) {
1729 PyObject *x = slot1(*operand1, operand2);
1731 if (x != Py_NotImplemented) {
1733 goto exit_inplace_result_object;
1736 Py_DECREF_IMMORTAL(x);
1741#if PYTHON_VERSION < 0x300
1742 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'float' and 'long'");
1744 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'float' and 'int'");
1746 goto exit_inplace_exception;
1749exit_inplace_result_object:
1750 if (unlikely(obj_result == NULL)) {
1755 Py_DECREF(*operand1);
1759 *operand1 = obj_result;
1763exit_inplace_exception:
1767bool INPLACE_OPERATION_TRUEDIV_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1768 return _INPLACE_OPERATION_TRUEDIV_FLOAT_LONG(operand1, operand2);
1772static inline bool _INPLACE_OPERATION_TRUEDIV_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
1775 CHECK_OBJECT(*operand1);
1776 assert(PyLong_CheckExact(*operand1));
1777 CHECK_OBJECT(operand2);
1778 assert(PyFloat_CheckExact(operand2));
1780#if defined(_MSC_VER)
1781#pragma warning(push)
1782#pragma warning(disable : 4101)
1784 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1785 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1786#if defined(_MSC_VER)
1794 binaryfunc slot2 = NULL;
1799 slot2 = PyFloat_Type.tp_as_number->nb_true_divide;
1802 if (slot2 != NULL) {
1803 PyObject *x = slot2(*operand1, operand2);
1805 if (x != Py_NotImplemented) {
1807 goto exit_inplace_result_object;
1810 Py_DECREF_IMMORTAL(x);
1815#if PYTHON_VERSION < 0x300
1816 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'long' and 'float'");
1818 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'int' and 'float'");
1820 goto exit_inplace_exception;
1823exit_inplace_result_object:
1824 if (unlikely(obj_result == NULL)) {
1829 Py_DECREF(*operand1);
1833 *operand1 = obj_result;
1837exit_inplace_exception:
1841bool INPLACE_OPERATION_TRUEDIV_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
1842 return _INPLACE_OPERATION_TRUEDIV_LONG_FLOAT(operand1, operand2);
1845#if PYTHON_VERSION < 0x300
1847static inline bool _INPLACE_OPERATION_TRUEDIV_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
1850 CHECK_OBJECT(*operand1);
1851 assert(PyFloat_CheckExact(*operand1));
1852 CHECK_OBJECT(operand2);
1853 assert(PyInt_CheckExact(operand2));
1855#if defined(_MSC_VER)
1856#pragma warning(push)
1857#pragma warning(disable : 4101)
1859 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1860 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1861#if defined(_MSC_VER)
1868 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_true_divide;
1871 if (slot1 != NULL) {
1872 PyObject *x = slot1(*operand1, operand2);
1874 if (x != Py_NotImplemented) {
1876 goto exit_inplace_result_object;
1879 Py_DECREF_IMMORTAL(x);
1884 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'float' and 'int'");
1885 goto exit_inplace_exception;
1888exit_inplace_result_object:
1889 if (unlikely(obj_result == NULL)) {
1894 Py_DECREF(*operand1);
1898 *operand1 = obj_result;
1902exit_inplace_exception:
1906bool INPLACE_OPERATION_TRUEDIV_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
1907 return _INPLACE_OPERATION_TRUEDIV_FLOAT_INT(operand1, operand2);
1911#if PYTHON_VERSION < 0x300
1913static inline bool _INPLACE_OPERATION_TRUEDIV_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
1916 CHECK_OBJECT(*operand1);
1917 assert(PyInt_CheckExact(*operand1));
1918 CHECK_OBJECT(operand2);
1919 assert(PyFloat_CheckExact(operand2));
1921#if defined(_MSC_VER)
1922#pragma warning(push)
1923#pragma warning(disable : 4101)
1925 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1926 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1927#if defined(_MSC_VER)
1935 binaryfunc slot2 = NULL;
1940 slot2 = PyFloat_Type.tp_as_number->nb_true_divide;
1943 if (slot2 != NULL) {
1944 PyObject *x = slot2(*operand1, operand2);
1946 if (x != Py_NotImplemented) {
1948 goto exit_inplace_result_object;
1951 Py_DECREF_IMMORTAL(x);
1956 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'int' and 'float'");
1957 goto exit_inplace_exception;
1960exit_inplace_result_object:
1961 if (unlikely(obj_result == NULL)) {
1966 Py_DECREF(*operand1);
1970 *operand1 = obj_result;
1974exit_inplace_exception:
1978bool INPLACE_OPERATION_TRUEDIV_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
1979 return _INPLACE_OPERATION_TRUEDIV_INT_FLOAT(operand1, operand2);
1983#if PYTHON_VERSION < 0x300
1985static inline bool _INPLACE_OPERATION_TRUEDIV_LONG_INT(PyObject **operand1, PyObject *operand2) {
1988 CHECK_OBJECT(*operand1);
1989 assert(PyLong_CheckExact(*operand1));
1990 CHECK_OBJECT(operand2);
1991 assert(PyInt_CheckExact(operand2));
1993#if defined(_MSC_VER)
1994#pragma warning(push)
1995#pragma warning(disable : 4101)
1997 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1998 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1999#if defined(_MSC_VER)
2006 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_true_divide;
2009 if (slot1 != NULL) {
2010 PyObject *x = slot1(*operand1, operand2);
2012 if (x != Py_NotImplemented) {
2014 goto exit_inplace_result_object;
2017 Py_DECREF_IMMORTAL(x);
2022 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'long' and 'int'");
2023 goto exit_inplace_exception;
2026exit_inplace_result_object:
2027 if (unlikely(obj_result == NULL)) {
2032 Py_DECREF(*operand1);
2036 *operand1 = obj_result;
2040exit_inplace_exception:
2044bool INPLACE_OPERATION_TRUEDIV_LONG_INT(PyObject **operand1, PyObject *operand2) {
2045 return _INPLACE_OPERATION_TRUEDIV_LONG_INT(operand1, operand2);
2049#if PYTHON_VERSION < 0x300
2051static inline bool _INPLACE_OPERATION_TRUEDIV_INT_LONG(PyObject **operand1, PyObject *operand2) {
2054 CHECK_OBJECT(*operand1);
2055 assert(PyInt_CheckExact(*operand1));
2056 CHECK_OBJECT(operand2);
2057 assert(PyLong_CheckExact(operand2));
2059#if defined(_MSC_VER)
2060#pragma warning(push)
2061#pragma warning(disable : 4101)
2063 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2064 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2065#if defined(_MSC_VER)
2073 binaryfunc slot2 = NULL;
2078 slot2 = PyLong_Type.tp_as_number->nb_true_divide;
2081 if (slot2 != NULL) {
2082 PyObject *x = slot2(*operand1, operand2);
2084 if (x != Py_NotImplemented) {
2086 goto exit_inplace_result_object;
2089 Py_DECREF_IMMORTAL(x);
2094 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: 'int' and 'long'");
2095 goto exit_inplace_exception;
2098exit_inplace_result_object:
2099 if (unlikely(obj_result == NULL)) {
2104 Py_DECREF(*operand1);
2108 *operand1 = obj_result;
2112exit_inplace_exception:
2116bool INPLACE_OPERATION_TRUEDIV_INT_LONG(PyObject **operand1, PyObject *operand2) {
2117 return _INPLACE_OPERATION_TRUEDIV_INT_LONG(operand1, operand2);
2121#if PYTHON_VERSION < 0x300
2123static inline bool _INPLACE_OPERATION_TRUEDIV_INT_CLONG(PyObject **operand1,
long operand2) {
2126 CHECK_OBJECT(*operand1);
2127 assert(PyInt_CheckExact(*operand1));
2130#if defined(_MSC_VER)
2131#pragma warning(push)
2132#pragma warning(disable : 4101)
2134 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2135 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2136 NUITKA_MAY_BE_UNUSED
long clong_result;
2137 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2138#if defined(_MSC_VER)
2142 CHECK_OBJECT(*operand1);
2143 assert(PyInt_CheckExact(*operand1));
2145 const long a = PyInt_AS_LONG(*operand1);
2146 const long b = operand2;
2148 if (unlikely(b == 0)) {
2149 PyThreadState *tstate = PyThreadState_GET();
2151 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"division by zero");
2152 goto exit_result_exception;
2157 goto exit_result_ok_const_float_minus_0_0;
2159 goto exit_result_ok_const_float_0_0;
2166#if DBL_MANT_DIG < WIDTH_OF_ULONG
2167 if ((a >= 0 ? 0UL + a : 0UL - a) >> DBL_MANT_DIG || (b >= 0 ? 0UL + b : 0UL - b) >> DBL_MANT_DIG) {
2171 double r = (double)a / (
double)b;
2174 goto exit_result_ok_cfloat;
2178 PyObject *operand1_object = *operand1;
2179 PyObject *operand2_object = Nuitka_PyLong_FromLong(operand2);
2181 PyObject *r = PyLong_Type.tp_as_number->nb_true_divide(operand1_object, operand2_object);
2182 assert(r != Py_NotImplemented);
2184 Py_DECREF(operand2_object);
2187 goto exit_result_object;
2190exit_result_ok_cfloat:
2193 Py_DECREF(*operand1);
2195 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2196 goto exit_result_ok;
2199 if (unlikely(obj_result == NULL)) {
2200 goto exit_result_exception;
2203 Py_DECREF(*operand1);
2205 *operand1 = obj_result;
2206 goto exit_result_ok;
2208exit_result_ok_const_float_0_0:
2210 Py_DECREF(*operand1);
2211 Py_INCREF(const_float_0_0);
2212 *operand1 = const_float_0_0;
2213 goto exit_result_ok;
2215exit_result_ok_const_float_minus_0_0:
2217 Py_DECREF(*operand1);
2218 Py_INCREF(const_float_minus_0_0);
2219 *operand1 = const_float_minus_0_0;
2220 goto exit_result_ok;
2225exit_result_exception:
2229bool INPLACE_OPERATION_TRUEDIV_INT_CLONG(PyObject **operand1,
long operand2) {
2230 return _INPLACE_OPERATION_TRUEDIV_INT_CLONG(operand1, operand2);
2235static inline bool _INPLACE_OPERATION_TRUEDIV_FLOAT_CFLOAT(PyObject **operand1,
double operand2) {
2238 CHECK_OBJECT(*operand1);
2239 assert(PyFloat_CheckExact(*operand1));
2241#if defined(_MSC_VER)
2242#pragma warning(push)
2243#pragma warning(disable : 4101)
2246 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2247 NUITKA_MAY_BE_UNUSED
long clong_result;
2248 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2249#if defined(_MSC_VER)
2253 CHECK_OBJECT(*operand1);
2254 assert(PyFloat_CheckExact(*operand1));
2256 const double a = PyFloat_AS_DOUBLE(*operand1);
2257 const double b = operand2;
2259 if (unlikely(b == 0.0)) {
2260 PyThreadState *tstate = PyThreadState_GET();
2262 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
2263 goto exit_result_exception;
2270 goto exit_result_ok_cfloat;
2273exit_result_ok_cfloat:
2274 if (Py_REFCNT(*operand1) == 1) {
2275 PyFloat_SET_DOUBLE(*operand1, cfloat_result);
2278 Py_DECREF(*operand1);
2280 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2282 goto exit_result_ok;
2287exit_result_exception:
2291bool INPLACE_OPERATION_TRUEDIV_FLOAT_CFLOAT(PyObject **operand1,
double operand2) {
2292 return _INPLACE_OPERATION_TRUEDIV_FLOAT_CFLOAT(operand1, operand2);
2296static inline bool _INPLACE_OPERATION_TRUEDIV_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
2299 CHECK_OBJECT(*operand1);
2300 CHECK_OBJECT(operand2);
2302#if PYTHON_VERSION < 0x300
2303 if (PyInt_CheckExact(*operand1) && PyInt_CheckExact(operand2)) {
2306#if defined(_MSC_VER)
2307#pragma warning(push)
2308#pragma warning(disable : 4101)
2310 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2311 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2312 NUITKA_MAY_BE_UNUSED
long clong_result;
2313 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2314#if defined(_MSC_VER)
2318 CHECK_OBJECT(*operand1);
2319 assert(PyInt_CheckExact(*operand1));
2320 CHECK_OBJECT(operand2);
2321 assert(PyInt_CheckExact(operand2));
2323 const long a = PyInt_AS_LONG(*operand1);
2324 const long b = PyInt_AS_LONG(operand2);
2326 if (unlikely(b == 0)) {
2327 PyThreadState *tstate = PyThreadState_GET();
2329 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"division by zero");
2330 goto exit_result_exception;
2335 goto exit_result_ok_const_float_minus_0_0;
2337 goto exit_result_ok_const_float_0_0;
2344#if DBL_MANT_DIG < WIDTH_OF_ULONG
2345 if ((a >= 0 ? 0UL + a : 0UL - a) >> DBL_MANT_DIG || (b >= 0 ? 0UL + b : 0UL - b) >> DBL_MANT_DIG) {
2349 double r = (double)a / (
double)b;
2352 goto exit_result_ok_cfloat;
2356 PyObject *operand1_object = *operand1;
2357 PyObject *operand2_object = operand2;
2359 PyObject *r = PyLong_Type.tp_as_number->nb_true_divide(operand1_object, operand2_object);
2360 assert(r != Py_NotImplemented);
2363 goto exit_result_object;
2366 exit_result_ok_cfloat:
2369 Py_DECREF(*operand1);
2371 *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2372 goto exit_result_ok;
2375 if (unlikely(obj_result == NULL)) {
2376 goto exit_result_exception;
2379 Py_DECREF(*operand1);
2381 *operand1 = obj_result;
2382 goto exit_result_ok;
2384 exit_result_ok_const_float_0_0:
2386 Py_DECREF(*operand1);
2387 Py_INCREF(const_float_0_0);
2388 *operand1 = const_float_0_0;
2389 goto exit_result_ok;
2391 exit_result_ok_const_float_minus_0_0:
2393 Py_DECREF(*operand1);
2394 Py_INCREF(const_float_minus_0_0);
2395 *operand1 = const_float_minus_0_0;
2396 goto exit_result_ok;
2401 exit_result_exception:
2406 if (Py_TYPE(*operand1) == Py_TYPE(operand2)) {
2407 if (PyFloat_CheckExact(operand2)) {
2408 return _INPLACE_OPERATION_TRUEDIV_FLOAT_FLOAT(operand1, operand2);
2410#if PYTHON_VERSION >= 0x300
2411 if (PyLong_CheckExact(operand2)) {
2412 return _INPLACE_OPERATION_TRUEDIV_LONG_LONG(operand1, operand2);
2417 PyTypeObject *type1 = Py_TYPE(*operand1);
2418 PyTypeObject *type2 = Py_TYPE(operand2);
2420#if defined(_MSC_VER)
2421#pragma warning(push)
2422#pragma warning(disable : 4101)
2424 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2425 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2426#if defined(_MSC_VER)
2430 binaryfunc islot = (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1))
2431 ? type1->tp_as_number->nb_inplace_true_divide
2434 if (islot != NULL) {
2435 PyObject *x = islot(*operand1, operand2);
2437 if (x != Py_NotImplemented) {
2439 goto exit_inplace_result_object;
2442 Py_DECREF_IMMORTAL(x);
2447 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
2448 binaryfunc slot2 = NULL;
2450 if (!(type1 == type2)) {
2453 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide
2456 if (slot1 == slot2) {
2461 if (slot1 != NULL) {
2462 if (slot2 != NULL) {
2463 if (Nuitka_Type_IsSubtype(type2, type1)) {
2464 PyObject *x = slot2(*operand1, operand2);
2466 if (x != Py_NotImplemented) {
2468 goto exit_inplace_result_object;
2471 Py_DECREF_IMMORTAL(x);
2476 PyObject *x = slot1(*operand1, operand2);
2478 if (x != Py_NotImplemented) {
2480 goto exit_inplace_result_object;
2483 Py_DECREF_IMMORTAL(x);
2486 if (slot2 != NULL) {
2487 PyObject *x = slot2(*operand1, operand2);
2489 if (x != Py_NotImplemented) {
2491 goto exit_inplace_result_object;
2494 Py_DECREF_IMMORTAL(x);
2497#if PYTHON_VERSION < 0x300
2498 if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
2500 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
2503 PyObject *coerced1 = *operand1;
2504 PyObject *coerced2 = operand2;
2506 int err = c1(&coerced1, &coerced2);
2508 if (unlikely(err < 0)) {
2509 goto exit_inplace_exception;
2513 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2515 if (likely(mv == NULL)) {
2516 binaryfunc slot = mv->nb_true_divide;
2518 if (likely(slot != NULL)) {
2519 PyObject *x = slot(coerced1, coerced2);
2521 Py_DECREF(coerced1);
2522 Py_DECREF(coerced2);
2525 goto exit_inplace_result_object;
2530 Py_DECREF(coerced1);
2531 Py_DECREF(coerced2);
2535 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2538 PyObject *coerced1 = *operand1;
2539 PyObject *coerced2 = operand2;
2541 int err = c2(&coerced2, &coerced1);
2543 if (unlikely(err < 0)) {
2544 goto exit_inplace_exception;
2548 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2550 if (likely(mv == NULL)) {
2551 binaryfunc slot = mv->nb_true_divide;
2553 if (likely(slot != NULL)) {
2554 PyObject *x = slot(coerced1, coerced2);
2556 Py_DECREF(coerced1);
2557 Py_DECREF(coerced2);
2560 goto exit_inplace_result_object;
2565 Py_DECREF(coerced1);
2566 Py_DECREF(coerced2);
2572 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /=: '%s' and '%s'", type1->tp_name,
2574 goto exit_inplace_exception;
2577exit_inplace_result_object:
2578 if (unlikely(obj_result == NULL)) {
2583 Py_DECREF(*operand1);
2587 *operand1 = obj_result;
2591exit_inplace_exception:
2595bool INPLACE_OPERATION_TRUEDIV_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
2596 return _INPLACE_OPERATION_TRUEDIV_OBJECT_OBJECT(operand1, operand2);