7#include "nuitka/prelude.h"
12#if PYTHON_VERSION < 0x300
14static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_INT_INT(PyObject *operand1, PyObject *operand2) {
15 CHECK_OBJECT(operand1);
16 assert(PyInt_CheckExact(operand1));
17 CHECK_OBJECT(operand2);
18 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;
81 result = Nuitka_PyInt_FromLong(clong_result);
85 if (unlikely(obj_result == NULL)) {
86 goto exit_result_exception;
98PyObject *BINARY_OPERATION_OLDDIV_OBJECT_INT_INT(PyObject *operand1, PyObject *operand2) {
99 return _BINARY_OPERATION_OLDDIV_OBJECT_INT_INT(operand1, operand2);
103#if PYTHON_VERSION < 0x300
105static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_INT(PyObject *operand1,
106 PyObject *operand2) {
107 PyTypeObject *type1 = Py_TYPE(operand1);
111#pragma warning(disable : 4101)
113 NUITKA_MAY_BE_UNUSED
bool cbool_result;
114 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
120 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
121 binaryfunc slot2 = NULL;
123 if (!(type1 == &PyInt_Type)) {
126 slot2 = PyInt_Type.tp_as_number->nb_divide;
128 if (slot1 == slot2) {
134 PyObject *x = slot1(operand1, operand2);
136 if (x != Py_NotImplemented) {
138 goto exit_binary_result_object;
141 Py_DECREF_IMMORTAL(x);
145 PyObject *x = slot2(operand1, operand2);
147 if (x != Py_NotImplemented) {
149 goto exit_binary_result_object;
152 Py_DECREF_IMMORTAL(x);
155#if PYTHON_VERSION < 0x300
156 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
158 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
161 PyObject *coerced1 = operand1;
162 PyObject *coerced2 = operand2;
164 int err = c1(&coerced1, &coerced2);
166 if (unlikely(err < 0)) {
167 goto exit_binary_exception;
171 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
173 if (likely(mv == NULL)) {
174 binaryfunc slot = mv->nb_divide;
176 if (likely(slot != NULL)) {
177 PyObject *x = slot(coerced1, coerced2);
183 goto exit_binary_result_object;
192 coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
195 PyObject *coerced1 = operand1;
196 PyObject *coerced2 = operand2;
198 int err = c2(&coerced2, &coerced1);
200 if (unlikely(err < 0)) {
201 goto exit_binary_exception;
205 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
207 if (likely(mv == NULL)) {
208 binaryfunc slot = mv->nb_divide;
210 if (likely(slot != NULL)) {
211 PyObject *x = slot(coerced1, coerced2);
217 goto exit_binary_result_object;
229 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: '%s' and 'int'", type1->tp_name);
230 goto exit_binary_exception;
232exit_binary_result_object:
235exit_binary_exception:
238static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
239 CHECK_OBJECT(operand1);
240 CHECK_OBJECT(operand2);
241 assert(PyInt_CheckExact(operand2));
243 PyTypeObject *type1 = Py_TYPE(operand1);
245 if (type1 == &PyInt_Type) {
253#pragma warning(disable : 4101)
255 NUITKA_MAY_BE_UNUSED
bool cbool_result;
256 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
257 NUITKA_MAY_BE_UNUSED
long clong_result;
258 NUITKA_MAY_BE_UNUSED
double cfloat_result;
263 CHECK_OBJECT(operand1);
264 assert(PyInt_CheckExact(operand1));
265 CHECK_OBJECT(operand2);
266 assert(PyInt_CheckExact(operand2));
268 const long a = PyInt_AS_LONG(operand1);
269 const long b = PyInt_AS_LONG(operand2);
271 if (unlikely(b == 0)) {
272 PyThreadState *tstate = PyThreadState_GET();
274 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"integer division or modulo by zero");
275 goto exit_result_exception;
284 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
285 long a_div_b = a / b;
286 long a_mod_b = (long)(a - (
unsigned long)a_div_b * b);
288 if (a_mod_b && (b ^ a_mod_b) < 0) {
293 clong_result = a_div_b;
294 goto exit_result_ok_clong;
298 PyObject *operand1_object = operand1;
299 PyObject *operand2_object = operand2;
301 PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
302 assert(r != Py_NotImplemented);
305 goto exit_result_object;
308 exit_result_ok_clong:
309 result = Nuitka_PyInt_FromLong(clong_result);
313 if (unlikely(obj_result == NULL)) {
314 goto exit_result_exception;
322 exit_result_exception:
326 return __BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_INT(operand1, operand2);
329PyObject *BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
330 return _BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_INT(operand1, operand2);
334#if PYTHON_VERSION < 0x300
336static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_OLDDIV_OBJECT_INT_OBJECT(PyObject *operand1,
337 PyObject *operand2) {
338 PyTypeObject *type2 = Py_TYPE(operand2);
342#pragma warning(disable : 4101)
344 NUITKA_MAY_BE_UNUSED
bool cbool_result;
345 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
350 binaryfunc slot1 = PyInt_Type.tp_as_number->nb_divide;
351 binaryfunc slot2 = NULL;
353 if (!(&PyInt_Type == type2)) {
356 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_divide : NULL;
358 if (slot1 == slot2) {
365 if (Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
366 PyObject *x = slot2(operand1, operand2);
368 if (x != Py_NotImplemented) {
370 goto exit_binary_result_object;
373 Py_DECREF_IMMORTAL(x);
378 PyObject *x = slot1(operand1, operand2);
380 if (x != Py_NotImplemented) {
382 goto exit_binary_result_object;
385 Py_DECREF_IMMORTAL(x);
389 PyObject *x = slot2(operand1, operand2);
391 if (x != Py_NotImplemented) {
393 goto exit_binary_result_object;
396 Py_DECREF_IMMORTAL(x);
399#if PYTHON_VERSION < 0x300
400 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
401 coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
404 PyObject *coerced1 = operand1;
405 PyObject *coerced2 = operand2;
407 int err = c1(&coerced1, &coerced2);
409 if (unlikely(err < 0)) {
410 goto exit_binary_exception;
414 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
416 if (likely(mv == NULL)) {
417 binaryfunc slot = mv->nb_divide;
419 if (likely(slot != NULL)) {
420 PyObject *x = slot(coerced1, coerced2);
426 goto exit_binary_result_object;
436 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
439 PyObject *coerced1 = operand1;
440 PyObject *coerced2 = operand2;
442 int err = c2(&coerced2, &coerced1);
444 if (unlikely(err < 0)) {
445 goto exit_binary_exception;
449 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
451 if (likely(mv == NULL)) {
452 binaryfunc slot = mv->nb_divide;
454 if (likely(slot != NULL)) {
455 PyObject *x = slot(coerced1, coerced2);
461 goto exit_binary_result_object;
473 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'int' and '%s'", type2->tp_name);
474 goto exit_binary_exception;
476exit_binary_result_object:
479exit_binary_exception:
482static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
483 CHECK_OBJECT(operand1);
484 assert(PyInt_CheckExact(operand1));
485 CHECK_OBJECT(operand2);
487 PyTypeObject *type2 = Py_TYPE(operand2);
489 if (&PyInt_Type == type2) {
497#pragma warning(disable : 4101)
499 NUITKA_MAY_BE_UNUSED
bool cbool_result;
500 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
501 NUITKA_MAY_BE_UNUSED
long clong_result;
502 NUITKA_MAY_BE_UNUSED
double cfloat_result;
507 CHECK_OBJECT(operand1);
508 assert(PyInt_CheckExact(operand1));
509 CHECK_OBJECT(operand2);
510 assert(PyInt_CheckExact(operand2));
512 const long a = PyInt_AS_LONG(operand1);
513 const long b = PyInt_AS_LONG(operand2);
515 if (unlikely(b == 0)) {
516 PyThreadState *tstate = PyThreadState_GET();
518 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"integer division or modulo by zero");
519 goto exit_result_exception;
528 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
529 long a_div_b = a / b;
530 long a_mod_b = (long)(a - (
unsigned long)a_div_b * b);
532 if (a_mod_b && (b ^ a_mod_b) < 0) {
537 clong_result = a_div_b;
538 goto exit_result_ok_clong;
542 PyObject *operand1_object = operand1;
543 PyObject *operand2_object = operand2;
545 PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
546 assert(r != Py_NotImplemented);
549 goto exit_result_object;
552 exit_result_ok_clong:
553 result = Nuitka_PyInt_FromLong(clong_result);
557 if (unlikely(obj_result == NULL)) {
558 goto exit_result_exception;
566 exit_result_exception:
570 return __BINARY_OPERATION_OLDDIV_OBJECT_INT_OBJECT(operand1, operand2);
573PyObject *BINARY_OPERATION_OLDDIV_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
574 return _BINARY_OPERATION_OLDDIV_OBJECT_INT_OBJECT(operand1, operand2);
578#if PYTHON_VERSION < 0x300
580static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_LONG_LONG(PyObject *operand1, PyObject *operand2) {
581 CHECK_OBJECT(operand1);
582 assert(PyLong_CheckExact(operand1));
583 CHECK_OBJECT(operand2);
584 assert(PyLong_CheckExact(operand2));
591#pragma warning(disable : 4101)
593 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
594 NUITKA_MAY_BE_UNUSED
long clong_result;
599 PyObject *x = PyLong_Type.tp_as_number->nb_divide(operand1, operand2);
600 assert(x != Py_NotImplemented);
603 goto exit_result_object;
606 if (unlikely(obj_result == NULL)) {
607 goto exit_result_exception;
615exit_result_exception:
619PyObject *BINARY_OPERATION_OLDDIV_OBJECT_LONG_LONG(PyObject *operand1, PyObject *operand2) {
620 return _BINARY_OPERATION_OLDDIV_OBJECT_LONG_LONG(operand1, operand2);
624#if PYTHON_VERSION < 0x300
626static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_LONG(PyObject *operand1,
627 PyObject *operand2) {
628 PyTypeObject *type1 = Py_TYPE(operand1);
632#pragma warning(disable : 4101)
634 NUITKA_MAY_BE_UNUSED
bool cbool_result;
635 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
641 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
642 binaryfunc slot2 = NULL;
644 if (!(type1 == &PyLong_Type)) {
647 slot2 = PyLong_Type.tp_as_number->nb_divide;
649 if (slot1 == slot2) {
655 PyObject *x = slot1(operand1, operand2);
657 if (x != Py_NotImplemented) {
659 goto exit_binary_result_object;
662 Py_DECREF_IMMORTAL(x);
666 PyObject *x = slot2(operand1, operand2);
668 if (x != Py_NotImplemented) {
670 goto exit_binary_result_object;
673 Py_DECREF_IMMORTAL(x);
676#if PYTHON_VERSION < 0x300
677 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
679 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
682 PyObject *coerced1 = operand1;
683 PyObject *coerced2 = operand2;
685 int err = c1(&coerced1, &coerced2);
687 if (unlikely(err < 0)) {
688 goto exit_binary_exception;
692 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
694 if (likely(mv == NULL)) {
695 binaryfunc slot = mv->nb_divide;
697 if (likely(slot != NULL)) {
698 PyObject *x = slot(coerced1, coerced2);
704 goto exit_binary_result_object;
713 coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
716 PyObject *coerced1 = operand1;
717 PyObject *coerced2 = operand2;
719 int err = c2(&coerced2, &coerced1);
721 if (unlikely(err < 0)) {
722 goto exit_binary_exception;
726 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
728 if (likely(mv == NULL)) {
729 binaryfunc slot = mv->nb_divide;
731 if (likely(slot != NULL)) {
732 PyObject *x = slot(coerced1, coerced2);
738 goto exit_binary_result_object;
750#if PYTHON_VERSION < 0x300
751 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: '%s' and 'long'", type1->tp_name);
753 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: '%s' and 'int'", type1->tp_name);
755 goto exit_binary_exception;
757exit_binary_result_object:
760exit_binary_exception:
763static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
764 CHECK_OBJECT(operand1);
765 CHECK_OBJECT(operand2);
766 assert(PyLong_CheckExact(operand2));
768 PyTypeObject *type1 = Py_TYPE(operand1);
770 if (type1 == &PyLong_Type) {
778#pragma warning(disable : 4101)
780 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
781 NUITKA_MAY_BE_UNUSED
long clong_result;
786 PyObject *x = PyLong_Type.tp_as_number->nb_divide(operand1, operand2);
787 assert(x != Py_NotImplemented);
790 goto exit_result_object;
793 if (unlikely(obj_result == NULL)) {
794 goto exit_result_exception;
802 exit_result_exception:
806 return __BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_LONG(operand1, operand2);
809PyObject *BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
810 return _BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_LONG(operand1, operand2);
814#if PYTHON_VERSION < 0x300
816static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_OLDDIV_OBJECT_LONG_OBJECT(PyObject *operand1,
817 PyObject *operand2) {
818 PyTypeObject *type2 = Py_TYPE(operand2);
822#pragma warning(disable : 4101)
824 NUITKA_MAY_BE_UNUSED
bool cbool_result;
825 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
830 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_divide;
831 binaryfunc slot2 = NULL;
833 if (!(&PyLong_Type == type2)) {
836 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_divide : NULL;
838 if (slot1 == slot2) {
845 if (Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
846 PyObject *x = slot2(operand1, operand2);
848 if (x != Py_NotImplemented) {
850 goto exit_binary_result_object;
853 Py_DECREF_IMMORTAL(x);
858 PyObject *x = slot1(operand1, operand2);
860 if (x != Py_NotImplemented) {
862 goto exit_binary_result_object;
865 Py_DECREF_IMMORTAL(x);
869 PyObject *x = slot2(operand1, operand2);
871 if (x != Py_NotImplemented) {
873 goto exit_binary_result_object;
876 Py_DECREF_IMMORTAL(x);
879#if PYTHON_VERSION < 0x300
880 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
881 coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
884 PyObject *coerced1 = operand1;
885 PyObject *coerced2 = operand2;
887 int err = c1(&coerced1, &coerced2);
889 if (unlikely(err < 0)) {
890 goto exit_binary_exception;
894 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
896 if (likely(mv == NULL)) {
897 binaryfunc slot = mv->nb_divide;
899 if (likely(slot != NULL)) {
900 PyObject *x = slot(coerced1, coerced2);
906 goto exit_binary_result_object;
916 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
919 PyObject *coerced1 = operand1;
920 PyObject *coerced2 = operand2;
922 int err = c2(&coerced2, &coerced1);
924 if (unlikely(err < 0)) {
925 goto exit_binary_exception;
929 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
931 if (likely(mv == NULL)) {
932 binaryfunc slot = mv->nb_divide;
934 if (likely(slot != NULL)) {
935 PyObject *x = slot(coerced1, coerced2);
941 goto exit_binary_result_object;
953#if PYTHON_VERSION < 0x300
954 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'long' and '%s'", type2->tp_name);
956 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'int' and '%s'", type2->tp_name);
958 goto exit_binary_exception;
960exit_binary_result_object:
963exit_binary_exception:
966static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
967 CHECK_OBJECT(operand1);
968 assert(PyLong_CheckExact(operand1));
969 CHECK_OBJECT(operand2);
971 PyTypeObject *type2 = Py_TYPE(operand2);
973 if (&PyLong_Type == type2) {
981#pragma warning(disable : 4101)
983 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
984 NUITKA_MAY_BE_UNUSED
long clong_result;
989 PyObject *x = PyLong_Type.tp_as_number->nb_divide(operand1, operand2);
990 assert(x != Py_NotImplemented);
993 goto exit_result_object;
996 if (unlikely(obj_result == NULL)) {
997 goto exit_result_exception;
1000 goto exit_result_ok;
1005 exit_result_exception:
1009 return __BINARY_OPERATION_OLDDIV_OBJECT_LONG_OBJECT(operand1, operand2);
1012PyObject *BINARY_OPERATION_OLDDIV_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
1013 return _BINARY_OPERATION_OLDDIV_OBJECT_LONG_OBJECT(operand1, operand2);
1017#if PYTHON_VERSION < 0x300
1019static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
1020 CHECK_OBJECT(operand1);
1021 assert(PyFloat_CheckExact(operand1));
1022 CHECK_OBJECT(operand2);
1023 assert(PyFloat_CheckExact(operand2));
1027#if defined(_MSC_VER)
1028#pragma warning(push)
1029#pragma warning(disable : 4101)
1032 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1033 NUITKA_MAY_BE_UNUSED
long clong_result;
1034 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1035#if defined(_MSC_VER)
1039 CHECK_OBJECT(operand1);
1040 assert(PyFloat_CheckExact(operand1));
1041 CHECK_OBJECT(operand2);
1042 assert(PyFloat_CheckExact(operand2));
1044 const double a = PyFloat_AS_DOUBLE(operand1);
1045 const double b = PyFloat_AS_DOUBLE(operand2);
1047 if (unlikely(b == 0.0)) {
1048 PyThreadState *tstate = PyThreadState_GET();
1050 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
1051 goto exit_result_exception;
1058 goto exit_result_ok_cfloat;
1061exit_result_ok_cfloat:
1062 result = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1063 goto exit_result_ok;
1068exit_result_exception:
1072PyObject *BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
1073 return _BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_FLOAT(operand1, operand2);
1077#if PYTHON_VERSION < 0x300
1079static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_FLOAT(PyObject *operand1,
1080 PyObject *operand2) {
1081 PyTypeObject *type1 = Py_TYPE(operand1);
1083#if defined(_MSC_VER)
1084#pragma warning(push)
1085#pragma warning(disable : 4101)
1087 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1088 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1089#if defined(_MSC_VER)
1094 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
1095 binaryfunc slot2 = NULL;
1097 if (!(type1 == &PyFloat_Type)) {
1100 slot2 = PyFloat_Type.tp_as_number->nb_divide;
1102 if (slot1 == slot2) {
1107 if (slot1 != NULL) {
1108 PyObject *x = slot1(operand1, operand2);
1110 if (x != Py_NotImplemented) {
1112 goto exit_binary_result_object;
1115 Py_DECREF_IMMORTAL(x);
1118 if (slot2 != NULL) {
1119 PyObject *x = slot2(operand1, operand2);
1121 if (x != Py_NotImplemented) {
1123 goto exit_binary_result_object;
1126 Py_DECREF_IMMORTAL(x);
1129#if PYTHON_VERSION < 0x300
1130 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1132 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1135 PyObject *coerced1 = operand1;
1136 PyObject *coerced2 = operand2;
1138 int err = c1(&coerced1, &coerced2);
1140 if (unlikely(err < 0)) {
1141 goto exit_binary_exception;
1145 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1147 if (likely(mv == NULL)) {
1148 binaryfunc slot = mv->nb_divide;
1150 if (likely(slot != NULL)) {
1151 PyObject *x = slot(coerced1, coerced2);
1153 Py_DECREF(coerced1);
1154 Py_DECREF(coerced2);
1157 goto exit_binary_result_object;
1162 Py_DECREF(coerced1);
1163 Py_DECREF(coerced2);
1166 coercion c2 = PyFloat_Type.tp_as_number->nb_coerce;
1169 PyObject *coerced1 = operand1;
1170 PyObject *coerced2 = operand2;
1172 int err = c2(&coerced2, &coerced1);
1174 if (unlikely(err < 0)) {
1175 goto exit_binary_exception;
1179 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1181 if (likely(mv == NULL)) {
1182 binaryfunc slot = mv->nb_divide;
1184 if (likely(slot != NULL)) {
1185 PyObject *x = slot(coerced1, coerced2);
1187 Py_DECREF(coerced1);
1188 Py_DECREF(coerced2);
1191 goto exit_binary_result_object;
1196 Py_DECREF(coerced1);
1197 Py_DECREF(coerced2);
1203 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: '%s' and 'float'", type1->tp_name);
1204 goto exit_binary_exception;
1206exit_binary_result_object:
1209exit_binary_exception:
1212static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
1213 CHECK_OBJECT(operand1);
1214 CHECK_OBJECT(operand2);
1215 assert(PyFloat_CheckExact(operand2));
1217 PyTypeObject *type1 = Py_TYPE(operand1);
1219 if (type1 == &PyFloat_Type) {
1224#if defined(_MSC_VER)
1225#pragma warning(push)
1226#pragma warning(disable : 4101)
1229 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1230 NUITKA_MAY_BE_UNUSED
long clong_result;
1231 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1232#if defined(_MSC_VER)
1236 CHECK_OBJECT(operand1);
1237 assert(PyFloat_CheckExact(operand1));
1238 CHECK_OBJECT(operand2);
1239 assert(PyFloat_CheckExact(operand2));
1241 const double a = PyFloat_AS_DOUBLE(operand1);
1242 const double b = PyFloat_AS_DOUBLE(operand2);
1244 if (unlikely(b == 0.0)) {
1245 PyThreadState *tstate = PyThreadState_GET();
1247 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
1248 goto exit_result_exception;
1255 goto exit_result_ok_cfloat;
1258 exit_result_ok_cfloat:
1259 result = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1260 goto exit_result_ok;
1265 exit_result_exception:
1269 return __BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_FLOAT(operand1, operand2);
1272PyObject *BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
1273 return _BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_FLOAT(operand1, operand2);
1277#if PYTHON_VERSION < 0x300
1279static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_OBJECT(PyObject *operand1,
1280 PyObject *operand2) {
1281 PyTypeObject *type2 = Py_TYPE(operand2);
1283#if defined(_MSC_VER)
1284#pragma warning(push)
1285#pragma warning(disable : 4101)
1287 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1288 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1289#if defined(_MSC_VER)
1293 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_divide;
1294 binaryfunc slot2 = NULL;
1296 if (!(&PyFloat_Type == type2)) {
1299 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_divide : NULL;
1301 if (slot1 == slot2) {
1306 if (slot1 != NULL) {
1307 if (slot2 != NULL) {
1308 if (Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
1309 PyObject *x = slot2(operand1, operand2);
1311 if (x != Py_NotImplemented) {
1313 goto exit_binary_result_object;
1316 Py_DECREF_IMMORTAL(x);
1321 PyObject *x = slot1(operand1, operand2);
1323 if (x != Py_NotImplemented) {
1325 goto exit_binary_result_object;
1328 Py_DECREF_IMMORTAL(x);
1331 if (slot2 != NULL) {
1332 PyObject *x = slot2(operand1, operand2);
1334 if (x != Py_NotImplemented) {
1336 goto exit_binary_result_object;
1339 Py_DECREF_IMMORTAL(x);
1342#if PYTHON_VERSION < 0x300
1343 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1344 coercion c1 = PyFloat_Type.tp_as_number->nb_coerce;
1347 PyObject *coerced1 = operand1;
1348 PyObject *coerced2 = operand2;
1350 int err = c1(&coerced1, &coerced2);
1352 if (unlikely(err < 0)) {
1353 goto exit_binary_exception;
1357 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1359 if (likely(mv == NULL)) {
1360 binaryfunc slot = mv->nb_divide;
1362 if (likely(slot != NULL)) {
1363 PyObject *x = slot(coerced1, coerced2);
1365 Py_DECREF(coerced1);
1366 Py_DECREF(coerced2);
1369 goto exit_binary_result_object;
1374 Py_DECREF(coerced1);
1375 Py_DECREF(coerced2);
1379 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1382 PyObject *coerced1 = operand1;
1383 PyObject *coerced2 = operand2;
1385 int err = c2(&coerced2, &coerced1);
1387 if (unlikely(err < 0)) {
1388 goto exit_binary_exception;
1392 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1394 if (likely(mv == NULL)) {
1395 binaryfunc slot = mv->nb_divide;
1397 if (likely(slot != NULL)) {
1398 PyObject *x = slot(coerced1, coerced2);
1400 Py_DECREF(coerced1);
1401 Py_DECREF(coerced2);
1404 goto exit_binary_result_object;
1409 Py_DECREF(coerced1);
1410 Py_DECREF(coerced2);
1416 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'float' and '%s'", type2->tp_name);
1417 goto exit_binary_exception;
1419exit_binary_result_object:
1422exit_binary_exception:
1425static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
1426 CHECK_OBJECT(operand1);
1427 assert(PyFloat_CheckExact(operand1));
1428 CHECK_OBJECT(operand2);
1430 PyTypeObject *type2 = Py_TYPE(operand2);
1432 if (&PyFloat_Type == type2) {
1437#if defined(_MSC_VER)
1438#pragma warning(push)
1439#pragma warning(disable : 4101)
1442 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1443 NUITKA_MAY_BE_UNUSED
long clong_result;
1444 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1445#if defined(_MSC_VER)
1449 CHECK_OBJECT(operand1);
1450 assert(PyFloat_CheckExact(operand1));
1451 CHECK_OBJECT(operand2);
1452 assert(PyFloat_CheckExact(operand2));
1454 const double a = PyFloat_AS_DOUBLE(operand1);
1455 const double b = PyFloat_AS_DOUBLE(operand2);
1457 if (unlikely(b == 0.0)) {
1458 PyThreadState *tstate = PyThreadState_GET();
1460 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
1461 goto exit_result_exception;
1468 goto exit_result_ok_cfloat;
1471 exit_result_ok_cfloat:
1472 result = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1473 goto exit_result_ok;
1478 exit_result_exception:
1482 return __BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_OBJECT(operand1, operand2);
1485PyObject *BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
1486 return _BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_OBJECT(operand1, operand2);
1490#if PYTHON_VERSION < 0x300
1492static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_LONG(PyObject *operand1, PyObject *operand2) {
1493 CHECK_OBJECT(operand1);
1494 assert(PyFloat_CheckExact(operand1));
1495 CHECK_OBJECT(operand2);
1496 assert(PyLong_CheckExact(operand2));
1498#if defined(_MSC_VER)
1499#pragma warning(push)
1500#pragma warning(disable : 4101)
1502 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1503 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1504#if defined(_MSC_VER)
1508 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_divide;
1511 if (slot1 != NULL) {
1512 PyObject *x = slot1(operand1, operand2);
1514 if (x != Py_NotImplemented) {
1516 goto exit_binary_result_object;
1519 Py_DECREF_IMMORTAL(x);
1524#if PYTHON_VERSION < 0x300
1525 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'float' and 'long'");
1527 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'float' and 'int'");
1529 goto exit_binary_exception;
1531exit_binary_result_object:
1534exit_binary_exception:
1538PyObject *BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_LONG(PyObject *operand1, PyObject *operand2) {
1539 return _BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_LONG(operand1, operand2);
1543#if PYTHON_VERSION < 0x300
1545static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_LONG_FLOAT(PyObject *operand1, PyObject *operand2) {
1546 CHECK_OBJECT(operand1);
1547 assert(PyLong_CheckExact(operand1));
1548 CHECK_OBJECT(operand2);
1549 assert(PyFloat_CheckExact(operand2));
1551#if defined(_MSC_VER)
1552#pragma warning(push)
1553#pragma warning(disable : 4101)
1555 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1556 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1557#if defined(_MSC_VER)
1562 binaryfunc slot2 = NULL;
1567 slot2 = PyFloat_Type.tp_as_number->nb_divide;
1570 if (slot2 != NULL) {
1571 PyObject *x = slot2(operand1, operand2);
1573 if (x != Py_NotImplemented) {
1575 goto exit_binary_result_object;
1578 Py_DECREF_IMMORTAL(x);
1583#if PYTHON_VERSION < 0x300
1584 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'long' and 'float'");
1586 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'int' and 'float'");
1588 goto exit_binary_exception;
1590exit_binary_result_object:
1593exit_binary_exception:
1597PyObject *BINARY_OPERATION_OLDDIV_OBJECT_LONG_FLOAT(PyObject *operand1, PyObject *operand2) {
1598 return _BINARY_OPERATION_OLDDIV_OBJECT_LONG_FLOAT(operand1, operand2);
1602#if PYTHON_VERSION < 0x300
1604static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_INT(PyObject *operand1, PyObject *operand2) {
1605 CHECK_OBJECT(operand1);
1606 assert(PyFloat_CheckExact(operand1));
1607 CHECK_OBJECT(operand2);
1608 assert(PyInt_CheckExact(operand2));
1610#if defined(_MSC_VER)
1611#pragma warning(push)
1612#pragma warning(disable : 4101)
1614 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1615 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1616#if defined(_MSC_VER)
1620 binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_divide;
1623 if (slot1 != NULL) {
1624 PyObject *x = slot1(operand1, operand2);
1626 if (x != Py_NotImplemented) {
1628 goto exit_binary_result_object;
1631 Py_DECREF_IMMORTAL(x);
1636 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'float' and 'int'");
1637 goto exit_binary_exception;
1639exit_binary_result_object:
1642exit_binary_exception:
1646PyObject *BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_INT(PyObject *operand1, PyObject *operand2) {
1647 return _BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_INT(operand1, operand2);
1651#if PYTHON_VERSION < 0x300
1653static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_INT_FLOAT(PyObject *operand1, PyObject *operand2) {
1654 CHECK_OBJECT(operand1);
1655 assert(PyInt_CheckExact(operand1));
1656 CHECK_OBJECT(operand2);
1657 assert(PyFloat_CheckExact(operand2));
1659#if defined(_MSC_VER)
1660#pragma warning(push)
1661#pragma warning(disable : 4101)
1663 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1664 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1665#if defined(_MSC_VER)
1670 binaryfunc slot2 = NULL;
1675 slot2 = PyFloat_Type.tp_as_number->nb_divide;
1678 if (slot2 != NULL) {
1679 PyObject *x = slot2(operand1, operand2);
1681 if (x != Py_NotImplemented) {
1683 goto exit_binary_result_object;
1686 Py_DECREF_IMMORTAL(x);
1691 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'int' and 'float'");
1692 goto exit_binary_exception;
1694exit_binary_result_object:
1697exit_binary_exception:
1701PyObject *BINARY_OPERATION_OLDDIV_OBJECT_INT_FLOAT(PyObject *operand1, PyObject *operand2) {
1702 return _BINARY_OPERATION_OLDDIV_OBJECT_INT_FLOAT(operand1, operand2);
1706#if PYTHON_VERSION < 0x300
1708static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
1709 CHECK_OBJECT(operand1);
1710 assert(PyLong_CheckExact(operand1));
1711 CHECK_OBJECT(operand2);
1712 assert(PyInt_CheckExact(operand2));
1714#if defined(_MSC_VER)
1715#pragma warning(push)
1716#pragma warning(disable : 4101)
1718 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1719 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1720#if defined(_MSC_VER)
1724 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_divide;
1727 if (slot1 != NULL) {
1728 PyObject *x = slot1(operand1, operand2);
1730 if (x != Py_NotImplemented) {
1732 goto exit_binary_result_object;
1735 Py_DECREF_IMMORTAL(x);
1740 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'long' and 'int'");
1741 goto exit_binary_exception;
1743exit_binary_result_object:
1746exit_binary_exception:
1750PyObject *BINARY_OPERATION_OLDDIV_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
1751 return _BINARY_OPERATION_OLDDIV_OBJECT_LONG_INT(operand1, operand2);
1755#if PYTHON_VERSION < 0x300
1757static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_INT_LONG(PyObject *operand1, PyObject *operand2) {
1758 CHECK_OBJECT(operand1);
1759 assert(PyInt_CheckExact(operand1));
1760 CHECK_OBJECT(operand2);
1761 assert(PyLong_CheckExact(operand2));
1763#if defined(_MSC_VER)
1764#pragma warning(push)
1765#pragma warning(disable : 4101)
1767 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1768 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1769#if defined(_MSC_VER)
1774 binaryfunc slot2 = NULL;
1779 slot2 = PyLong_Type.tp_as_number->nb_divide;
1782 if (slot2 != NULL) {
1783 PyObject *x = slot2(operand1, operand2);
1785 if (x != Py_NotImplemented) {
1787 goto exit_binary_result_object;
1790 Py_DECREF_IMMORTAL(x);
1795 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: 'int' and 'long'");
1796 goto exit_binary_exception;
1798exit_binary_result_object:
1801exit_binary_exception:
1805PyObject *BINARY_OPERATION_OLDDIV_OBJECT_INT_LONG(PyObject *operand1, PyObject *operand2) {
1806 return _BINARY_OPERATION_OLDDIV_OBJECT_INT_LONG(operand1, operand2);
1810#if PYTHON_VERSION < 0x300
1812static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_INT_CLONG(PyObject *operand1,
long operand2) {
1813 CHECK_OBJECT(operand1);
1814 assert(PyInt_CheckExact(operand1));
1819#if defined(_MSC_VER)
1820#pragma warning(push)
1821#pragma warning(disable : 4101)
1823 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1824 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1825 NUITKA_MAY_BE_UNUSED
long clong_result;
1826 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1827#if defined(_MSC_VER)
1831 CHECK_OBJECT(operand1);
1832 assert(PyInt_CheckExact(operand1));
1834 const long a = PyInt_AS_LONG(operand1);
1835 const long b = operand2;
1837 if (unlikely(b == 0)) {
1838 PyThreadState *tstate = PyThreadState_GET();
1840 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"integer division or modulo by zero");
1841 goto exit_result_exception;
1850 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
1851 long a_div_b = a / b;
1852 long a_mod_b = (long)(a - (
unsigned long)a_div_b * b);
1854 if (a_mod_b && (b ^ a_mod_b) < 0) {
1859 clong_result = a_div_b;
1860 goto exit_result_ok_clong;
1864 PyObject *operand1_object = operand1;
1865 PyObject *operand2_object = Nuitka_PyLong_FromLong(operand2);
1867 PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
1868 assert(r != Py_NotImplemented);
1870 Py_DECREF(operand2_object);
1873 goto exit_result_object;
1876exit_result_ok_clong:
1877 result = Nuitka_PyInt_FromLong(clong_result);
1878 goto exit_result_ok;
1881 if (unlikely(obj_result == NULL)) {
1882 goto exit_result_exception;
1884 result = obj_result;
1885 goto exit_result_ok;
1890exit_result_exception:
1894PyObject *BINARY_OPERATION_OLDDIV_OBJECT_INT_CLONG(PyObject *operand1,
long operand2) {
1895 return _BINARY_OPERATION_OLDDIV_OBJECT_INT_CLONG(operand1, operand2);
1899#if PYTHON_VERSION < 0x300
1901static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_CLONG_INT(
long operand1, PyObject *operand2) {
1903 CHECK_OBJECT(operand2);
1904 assert(PyInt_CheckExact(operand2));
1909#if defined(_MSC_VER)
1910#pragma warning(push)
1911#pragma warning(disable : 4101)
1913 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1914 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1915 NUITKA_MAY_BE_UNUSED
long clong_result;
1916 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1917#if defined(_MSC_VER)
1921 CHECK_OBJECT(operand2);
1922 assert(PyInt_CheckExact(operand2));
1924 const long a = operand1;
1925 const long b = PyInt_AS_LONG(operand2);
1927 if (unlikely(b == 0)) {
1928 PyThreadState *tstate = PyThreadState_GET();
1930 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"integer division or modulo by zero");
1931 goto exit_result_exception;
1940 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
1941 long a_div_b = a / b;
1942 long a_mod_b = (long)(a - (
unsigned long)a_div_b * b);
1944 if (a_mod_b && (b ^ a_mod_b) < 0) {
1949 clong_result = a_div_b;
1950 goto exit_result_ok_clong;
1954 PyObject *operand1_object = Nuitka_PyLong_FromLong(operand1);
1955 PyObject *operand2_object = operand2;
1957 PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
1958 assert(r != Py_NotImplemented);
1960 Py_DECREF(operand1_object);
1963 goto exit_result_object;
1966exit_result_ok_clong:
1967 result = Nuitka_PyInt_FromLong(clong_result);
1968 goto exit_result_ok;
1971 if (unlikely(obj_result == NULL)) {
1972 goto exit_result_exception;
1974 result = obj_result;
1975 goto exit_result_ok;
1980exit_result_exception:
1984PyObject *BINARY_OPERATION_OLDDIV_OBJECT_CLONG_INT(
long operand1, PyObject *operand2) {
1985 return _BINARY_OPERATION_OLDDIV_OBJECT_CLONG_INT(operand1, operand2);
1989#if PYTHON_VERSION < 0x300
1991static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
1992 CHECK_OBJECT(operand1);
1993 assert(PyFloat_CheckExact(operand1));
1997#if defined(_MSC_VER)
1998#pragma warning(push)
1999#pragma warning(disable : 4101)
2002 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2003 NUITKA_MAY_BE_UNUSED
long clong_result;
2004 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2005#if defined(_MSC_VER)
2009 CHECK_OBJECT(operand1);
2010 assert(PyFloat_CheckExact(operand1));
2012 const double a = PyFloat_AS_DOUBLE(operand1);
2013 const double b = operand2;
2015 if (unlikely(b == 0.0)) {
2016 PyThreadState *tstate = PyThreadState_GET();
2018 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
2019 goto exit_result_exception;
2026 goto exit_result_ok_cfloat;
2029exit_result_ok_cfloat:
2030 result = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2031 goto exit_result_ok;
2036exit_result_exception:
2040PyObject *BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
2041 return _BINARY_OPERATION_OLDDIV_OBJECT_FLOAT_CFLOAT(operand1, operand2);
2045#if PYTHON_VERSION < 0x300
2047static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_CFLOAT_FLOAT(
double operand1, PyObject *operand2) {
2049 CHECK_OBJECT(operand2);
2050 assert(PyFloat_CheckExact(operand2));
2054#if defined(_MSC_VER)
2055#pragma warning(push)
2056#pragma warning(disable : 4101)
2059 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2060 NUITKA_MAY_BE_UNUSED
long clong_result;
2061 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2062#if defined(_MSC_VER)
2066 CHECK_OBJECT(operand2);
2067 assert(PyFloat_CheckExact(operand2));
2069 const double a = operand1;
2070 const double b = PyFloat_AS_DOUBLE(operand2);
2072 if (unlikely(b == 0.0)) {
2073 PyThreadState *tstate = PyThreadState_GET();
2075 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"float division by zero");
2076 goto exit_result_exception;
2083 goto exit_result_ok_cfloat;
2086exit_result_ok_cfloat:
2087 result = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2088 goto exit_result_ok;
2093exit_result_exception:
2097PyObject *BINARY_OPERATION_OLDDIV_OBJECT_CFLOAT_FLOAT(
double operand1, PyObject *operand2) {
2098 return _BINARY_OPERATION_OLDDIV_OBJECT_CFLOAT_FLOAT(operand1, operand2);
2102#if PYTHON_VERSION < 0x300
2104static PyObject *_BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
2105 CHECK_OBJECT(operand1);
2106 CHECK_OBJECT(operand2);
2108#if PYTHON_VERSION < 0x300
2109 if (PyInt_CheckExact(operand1) && PyInt_CheckExact(operand2)) {
2113#if defined(_MSC_VER)
2114#pragma warning(push)
2115#pragma warning(disable : 4101)
2117 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2118 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2119 NUITKA_MAY_BE_UNUSED
long clong_result;
2120 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2121#if defined(_MSC_VER)
2125 CHECK_OBJECT(operand1);
2126 assert(PyInt_CheckExact(operand1));
2127 CHECK_OBJECT(operand2);
2128 assert(PyInt_CheckExact(operand2));
2130 const long a = PyInt_AS_LONG(operand1);
2131 const long b = PyInt_AS_LONG(operand2);
2133 if (unlikely(b == 0)) {
2134 PyThreadState *tstate = PyThreadState_GET();
2136 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError,
"integer division or modulo by zero");
2137 goto exit_result_exception;
2146 if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
2147 long a_div_b = a / b;
2148 long a_mod_b = (long)(a - (
unsigned long)a_div_b * b);
2150 if (a_mod_b && (b ^ a_mod_b) < 0) {
2155 clong_result = a_div_b;
2156 goto exit_result_ok_clong;
2160 PyObject *operand1_object = operand1;
2161 PyObject *operand2_object = operand2;
2163 PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
2164 assert(r != Py_NotImplemented);
2167 goto exit_result_object;
2170 exit_result_ok_clong:
2171 result = Nuitka_PyInt_FromLong(clong_result);
2172 goto exit_result_ok;
2175 if (unlikely(obj_result == NULL)) {
2176 goto exit_result_exception;
2178 result = obj_result;
2179 goto exit_result_ok;
2184 exit_result_exception:
2189 PyTypeObject *type1 = Py_TYPE(operand1);
2190 PyTypeObject *type2 = Py_TYPE(operand2);
2192#if defined(_MSC_VER)
2193#pragma warning(push)
2194#pragma warning(disable : 4101)
2196 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2197 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2198#if defined(_MSC_VER)
2203 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
2204 binaryfunc slot2 = NULL;
2206 if (!(type1 == type2)) {
2209 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_divide : NULL;
2211 if (slot1 == slot2) {
2216 if (slot1 != NULL) {
2217 if (slot2 != NULL) {
2218 if (Nuitka_Type_IsSubtype(type2, type1)) {
2219 PyObject *x = slot2(operand1, operand2);
2221 if (x != Py_NotImplemented) {
2223 goto exit_binary_result_object;
2226 Py_DECREF_IMMORTAL(x);
2231 PyObject *x = slot1(operand1, operand2);
2233 if (x != Py_NotImplemented) {
2235 goto exit_binary_result_object;
2238 Py_DECREF_IMMORTAL(x);
2241 if (slot2 != NULL) {
2242 PyObject *x = slot2(operand1, operand2);
2244 if (x != Py_NotImplemented) {
2246 goto exit_binary_result_object;
2249 Py_DECREF_IMMORTAL(x);
2252#if PYTHON_VERSION < 0x300
2253 if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
2255 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
2258 PyObject *coerced1 = operand1;
2259 PyObject *coerced2 = operand2;
2261 int err = c1(&coerced1, &coerced2);
2263 if (unlikely(err < 0)) {
2264 goto exit_binary_exception;
2268 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2270 if (likely(mv == NULL)) {
2271 binaryfunc slot = mv->nb_divide;
2273 if (likely(slot != NULL)) {
2274 PyObject *x = slot(coerced1, coerced2);
2276 Py_DECREF(coerced1);
2277 Py_DECREF(coerced2);
2280 goto exit_binary_result_object;
2285 Py_DECREF(coerced1);
2286 Py_DECREF(coerced2);
2290 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2293 PyObject *coerced1 = operand1;
2294 PyObject *coerced2 = operand2;
2296 int err = c2(&coerced2, &coerced1);
2298 if (unlikely(err < 0)) {
2299 goto exit_binary_exception;
2303 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2305 if (likely(mv == NULL)) {
2306 binaryfunc slot = mv->nb_divide;
2308 if (likely(slot != NULL)) {
2309 PyObject *x = slot(coerced1, coerced2);
2311 Py_DECREF(coerced1);
2312 Py_DECREF(coerced2);
2315 goto exit_binary_result_object;
2320 Py_DECREF(coerced1);
2321 Py_DECREF(coerced2);
2327 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for /: '%s' and '%s'", type1->tp_name, type2->tp_name);
2328 goto exit_binary_exception;
2330exit_binary_result_object:
2333exit_binary_exception:
2337PyObject *BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
2338 return _BINARY_OPERATION_OLDDIV_OBJECT_OBJECT_OBJECT(operand1, operand2);