1 //     Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
2 //
3 //     Part of "Nuitka", an optimizing Python compiler that is compatible and
4 //     integrates with CPython, but also works on its own.
5 //
6 //     Licensed under the Apache License, Version 2.0 (the "License");
7 //     you may not use this file except in compliance with the License.
8 //     You may obtain a copy of the License at
9 //
10 //        http://www.apache.org/licenses/LICENSE-2.0
11 //
12 //     Unless required by applicable law or agreed to in writing, software
13 //     distributed under the License is distributed on an "AS IS" BASIS,
14 //     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 //     See the License for the specific language governing permissions and
16 //     limitations under the License.
17 //
18 /* WARNING, this code is GENERATED. Modify the template HelperOperationBinary.c.j2 instead! */
19 
20 /* This file is included from another C file, help IDEs to still parse it on its own. */
21 #ifdef __IDE_ONLY__
22 #include "nuitka/prelude.h"
23 #endif
24 
25 /* C helpers for type specialized "/" (TRUEDIV) operations */
26 
27 #if PYTHON_VERSION < 0x300
28 /* Code referring to "INT" corresponds to Python2 'int' and "INT" to Python2 'int'. */
_BINARY_OPERATION_TRUEDIV_OBJECT_INT_INT(PyObject * operand1,PyObject * operand2)29 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_INT_INT(PyObject *operand1, PyObject *operand2) {
30     CHECK_OBJECT(operand1);
31     assert(PyInt_CheckExact(operand1));
32 #if PYTHON_VERSION < 0x300
33     assert(NEW_STYLE_NUMBER(operand1));
34 #endif
35     CHECK_OBJECT(operand2);
36     assert(PyInt_CheckExact(operand2));
37 #if PYTHON_VERSION < 0x300
38     assert(NEW_STYLE_NUMBER(operand2));
39 #endif
40 
41     PyObject *result;
42 
43     // Not every code path will make use of all possible results.
44 #ifdef _MSC_VER
45 #pragma warning(push)
46 #pragma warning(disable : 4101)
47 #endif
48     NUITKA_MAY_BE_UNUSED bool cbool_result;
49     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
50     NUITKA_MAY_BE_UNUSED long clong_result;
51     NUITKA_MAY_BE_UNUSED double cfloat_result;
52 #ifdef _MSC_VER
53 #pragma warning(pop)
54 #endif
55 
56     CHECK_OBJECT(operand1);
57     assert(PyInt_CheckExact(operand1));
58 #if PYTHON_VERSION < 0x300
59     assert(NEW_STYLE_NUMBER(operand1));
60 #endif
61     CHECK_OBJECT(operand2);
62     assert(PyInt_CheckExact(operand2));
63 #if PYTHON_VERSION < 0x300
64     assert(NEW_STYLE_NUMBER(operand2));
65 #endif
66 
67     const long a = PyInt_AS_LONG(operand1);
68     const long b = PyInt_AS_LONG(operand2);
69 
70     if (unlikely(b == 0)) {
71         SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "division by zero");
72         goto exit_result_exception;
73     }
74 
75     if (a == 0) {
76         if (b < 0) {
77             goto exit_result_ok_const_float_minus_0_0;
78         } else {
79             goto exit_result_ok_const_float_0_0;
80         }
81     }
82 
83 /* May need to resort to LONG code, which we currently do not
84  * specialize yet. TODO: Once we do that, call it here instead.
85  */
86 #if DBL_MANT_DIG < WIDTH_OF_ULONG
87     if ((a >= 0 ? 0UL + a : 0UL - a) >> DBL_MANT_DIG || (b >= 0 ? 0UL + b : 0UL - b) >> DBL_MANT_DIG) {
88     } else
89 #endif
90     {
91         double r = (double)a / (double)b;
92 
93         cfloat_result = r;
94         goto exit_result_ok_cfloat;
95     }
96     {
97         PyObject *operand1_object = operand1;
98         PyObject *operand2_object = operand2;
99 
100         PyObject *r = PyLong_Type.tp_as_number->nb_true_divide(operand1_object, operand2_object);
101         assert(r != Py_NotImplemented);
102 
103         obj_result = r;
104         goto exit_result_object;
105     }
106 
107 exit_result_ok_cfloat:
108     result = PyFloat_FromDouble(cfloat_result);
109     goto exit_result_ok;
110 
111 exit_result_object:
112     if (unlikely(obj_result == NULL)) {
113         goto exit_result_exception;
114     }
115     result = obj_result;
116     goto exit_result_ok;
117 
118 exit_result_ok_const_float_0_0:
119     Py_INCREF(const_float_0_0);
120     result = const_float_0_0;
121     goto exit_result_ok;
122 
123 exit_result_ok_const_float_minus_0_0:
124     Py_INCREF(const_float_minus_0_0);
125     result = const_float_minus_0_0;
126     goto exit_result_ok;
127 
128 exit_result_ok:
129     return result;
130 
131 exit_result_exception:
132     return NULL;
133 }
134 
BINARY_OPERATION_TRUEDIV_OBJECT_INT_INT(PyObject * operand1,PyObject * operand2)135 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_INT_INT(PyObject *operand1, PyObject *operand2) {
136     return _BINARY_OPERATION_TRUEDIV_OBJECT_INT_INT(operand1, operand2);
137 }
138 #endif
139 
140 #if PYTHON_VERSION < 0x300
141 /* Code referring to "OBJECT" corresponds to any Python object and "INT" to Python2 'int'. */
__BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_INT(PyObject * operand1,PyObject * operand2)142 static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_INT(PyObject *operand1,
143                                                                                   PyObject *operand2) {
144     PyTypeObject *type1 = Py_TYPE(operand1);
145     PyTypeObject *type2 = &PyInt_Type;
146 
147 #ifdef _MSC_VER
148 #pragma warning(push)
149 #pragma warning(disable : 4101)
150 #endif
151     NUITKA_MAY_BE_UNUSED bool cbool_result;
152     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
153 #ifdef _MSC_VER
154 #pragma warning(pop)
155 #endif
156 
157     binaryfunc slot1 =
158         (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
159     binaryfunc slot2 = NULL;
160 
161     if (!(type1 == type2)) {
162         assert(type1 != type2);
163         /* Different types, need to consider second value slot. */
164 
165         slot2 = PyInt_Type.tp_as_number->nb_true_divide;
166 
167         if (slot1 == slot2) {
168             slot2 = NULL;
169         }
170     }
171 
172     if (slot1 != NULL) {
173         PyObject *x = slot1(operand1, operand2);
174 
175         if (x != Py_NotImplemented) {
176             obj_result = x;
177             goto exit_binary_result_object;
178         }
179 
180         Py_DECREF(x);
181     }
182 
183     if (slot2 != NULL) {
184         PyObject *x = slot2(operand1, operand2);
185 
186         if (x != Py_NotImplemented) {
187             obj_result = x;
188             goto exit_binary_result_object;
189         }
190 
191         Py_DECREF(x);
192     }
193 
194 #if PYTHON_VERSION < 0x300
195     if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
196         coercion c1 =
197             (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
198 
199         if (c1 != NULL) {
200             PyObject *coerced1 = operand1;
201             PyObject *coerced2 = operand2;
202 
203             int err = c1(&coerced1, &coerced2);
204 
205             if (unlikely(err < 0)) {
206                 goto exit_binary_exception;
207             }
208 
209             if (err == 0) {
210                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
211 
212                 if (likely(mv == NULL)) {
213                     binaryfunc slot = mv->nb_true_divide;
214 
215                     if (likely(slot != NULL)) {
216                         PyObject *x = slot(coerced1, coerced2);
217 
218                         Py_DECREF(coerced1);
219                         Py_DECREF(coerced2);
220 
221                         obj_result = x;
222                         goto exit_binary_result_object;
223                     }
224                 }
225 
226                 // nb_coerce took a reference.
227                 Py_DECREF(coerced1);
228                 Py_DECREF(coerced2);
229             }
230         }
231         coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
232 
233         if (c2 != NULL) {
234             PyObject *coerced1 = operand1;
235             PyObject *coerced2 = operand2;
236 
237             int err = c2(&coerced2, &coerced1);
238 
239             if (unlikely(err < 0)) {
240                 goto exit_binary_exception;
241             }
242 
243             if (err == 0) {
244                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
245 
246                 if (likely(mv == NULL)) {
247                     binaryfunc slot = mv->nb_true_divide;
248 
249                     if (likely(slot != NULL)) {
250                         PyObject *x = slot(coerced1, coerced2);
251 
252                         Py_DECREF(coerced1);
253                         Py_DECREF(coerced2);
254 
255                         obj_result = x;
256                         goto exit_binary_result_object;
257                     }
258                 }
259 
260                 // nb_coerce took a reference.
261                 Py_DECREF(coerced1);
262                 Py_DECREF(coerced2);
263             }
264         }
265     }
266 #endif
267 
268     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and 'int'", type1->tp_name);
269     goto exit_binary_exception;
270 
271 exit_binary_result_object:
272     return obj_result;
273 
274 exit_binary_exception:
275     return NULL;
276 }
_BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_INT(PyObject * operand1,PyObject * operand2)277 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
278     CHECK_OBJECT(operand1);
279     CHECK_OBJECT(operand2);
280     assert(PyInt_CheckExact(operand2));
281 #if PYTHON_VERSION < 0x300
282     assert(NEW_STYLE_NUMBER(operand2));
283 #endif
284 
285     PyTypeObject *type1 = Py_TYPE(operand1);
286     PyTypeObject *type2 = &PyInt_Type;
287 
288     if (type1 == type2) {
289         assert(type1 == type2);
290 
291         PyObject *result;
292 
293         // return _BINARY_OPERATION_TRUEDIV_OBJECT_INT_INT(operand1, operand2);
294 
295         // Not every code path will make use of all possible results.
296 #ifdef _MSC_VER
297 #pragma warning(push)
298 #pragma warning(disable : 4101)
299 #endif
300         NUITKA_MAY_BE_UNUSED bool cbool_result;
301         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
302         NUITKA_MAY_BE_UNUSED long clong_result;
303         NUITKA_MAY_BE_UNUSED double cfloat_result;
304 #ifdef _MSC_VER
305 #pragma warning(pop)
306 #endif
307 
308         CHECK_OBJECT(operand1);
309         assert(PyInt_CheckExact(operand1));
310 #if PYTHON_VERSION < 0x300
311         assert(NEW_STYLE_NUMBER(operand1));
312 #endif
313         CHECK_OBJECT(operand2);
314         assert(PyInt_CheckExact(operand2));
315 #if PYTHON_VERSION < 0x300
316         assert(NEW_STYLE_NUMBER(operand2));
317 #endif
318 
319         const long a = PyInt_AS_LONG(operand1);
320         const long b = PyInt_AS_LONG(operand2);
321 
322         if (unlikely(b == 0)) {
323             SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "division by zero");
324             goto exit_result_exception;
325         }
326 
327         if (a == 0) {
328             if (b < 0) {
329                 goto exit_result_ok_const_float_minus_0_0;
330             } else {
331                 goto exit_result_ok_const_float_0_0;
332             }
333         }
334 
335 /* May need to resort to LONG code, which we currently do not
336  * specialize yet. TODO: Once we do that, call it here instead.
337  */
338 #if DBL_MANT_DIG < WIDTH_OF_ULONG
339         if ((a >= 0 ? 0UL + a : 0UL - a) >> DBL_MANT_DIG || (b >= 0 ? 0UL + b : 0UL - b) >> DBL_MANT_DIG) {
340         } else
341 #endif
342         {
343             double r = (double)a / (double)b;
344 
345             cfloat_result = r;
346             goto exit_result_ok_cfloat;
347         }
348         {
349             PyObject *operand1_object = operand1;
350             PyObject *operand2_object = operand2;
351 
352             PyObject *r = PyLong_Type.tp_as_number->nb_true_divide(operand1_object, operand2_object);
353             assert(r != Py_NotImplemented);
354 
355             obj_result = r;
356             goto exit_result_object;
357         }
358 
359     exit_result_ok_cfloat:
360         result = PyFloat_FromDouble(cfloat_result);
361         goto exit_result_ok;
362 
363     exit_result_object:
364         if (unlikely(obj_result == NULL)) {
365             goto exit_result_exception;
366         }
367         result = obj_result;
368         goto exit_result_ok;
369 
370     exit_result_ok_const_float_0_0:
371         Py_INCREF(const_float_0_0);
372         result = const_float_0_0;
373         goto exit_result_ok;
374 
375     exit_result_ok_const_float_minus_0_0:
376         Py_INCREF(const_float_minus_0_0);
377         result = const_float_minus_0_0;
378         goto exit_result_ok;
379 
380     exit_result_ok:
381         return result;
382 
383     exit_result_exception:
384         return NULL;
385     }
386 
387     return __BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_INT(operand1, operand2);
388 }
389 
BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_INT(PyObject * operand1,PyObject * operand2)390 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
391     return _BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_INT(operand1, operand2);
392 }
393 #endif
394 
395 #if PYTHON_VERSION < 0x300
396 /* Code referring to "INT" corresponds to Python2 'int' and "OBJECT" to any Python object. */
__BINARY_OPERATION_TRUEDIV_OBJECT_INT_OBJECT(PyObject * operand1,PyObject * operand2)397 static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_TRUEDIV_OBJECT_INT_OBJECT(PyObject *operand1,
398                                                                                   PyObject *operand2) {
399     PyTypeObject *type1 = &PyInt_Type;
400     PyTypeObject *type2 = Py_TYPE(operand2);
401 
402 #ifdef _MSC_VER
403 #pragma warning(push)
404 #pragma warning(disable : 4101)
405 #endif
406     NUITKA_MAY_BE_UNUSED bool cbool_result;
407     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
408 #ifdef _MSC_VER
409 #pragma warning(pop)
410 #endif
411 
412     binaryfunc slot1 = PyInt_Type.tp_as_number->nb_true_divide;
413     binaryfunc slot2 = NULL;
414 
415     if (!(type1 == type2)) {
416         assert(type1 != type2);
417         /* Different types, need to consider second value slot. */
418 
419         slot2 =
420             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide : NULL;
421 
422         if (slot1 == slot2) {
423             slot2 = NULL;
424         }
425     }
426 
427     if (slot1 != NULL) {
428         if (slot2 != NULL) {
429             if (PyType_IsSubtype(type2, type1)) {
430                 PyObject *x = slot2(operand1, operand2);
431 
432                 if (x != Py_NotImplemented) {
433                     obj_result = x;
434                     goto exit_binary_result_object;
435                 }
436 
437                 Py_DECREF(x);
438                 slot2 = NULL;
439             }
440         }
441 
442         PyObject *x = slot1(operand1, operand2);
443 
444         if (x != Py_NotImplemented) {
445             obj_result = x;
446             goto exit_binary_result_object;
447         }
448 
449         Py_DECREF(x);
450     }
451 
452     if (slot2 != NULL) {
453         PyObject *x = slot2(operand1, operand2);
454 
455         if (x != Py_NotImplemented) {
456             obj_result = x;
457             goto exit_binary_result_object;
458         }
459 
460         Py_DECREF(x);
461     }
462 
463 #if PYTHON_VERSION < 0x300
464     if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
465         coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
466 
467         if (c1 != NULL) {
468             PyObject *coerced1 = operand1;
469             PyObject *coerced2 = operand2;
470 
471             int err = c1(&coerced1, &coerced2);
472 
473             if (unlikely(err < 0)) {
474                 goto exit_binary_exception;
475             }
476 
477             if (err == 0) {
478                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
479 
480                 if (likely(mv == NULL)) {
481                     binaryfunc slot = mv->nb_true_divide;
482 
483                     if (likely(slot != NULL)) {
484                         PyObject *x = slot(coerced1, coerced2);
485 
486                         Py_DECREF(coerced1);
487                         Py_DECREF(coerced2);
488 
489                         obj_result = x;
490                         goto exit_binary_result_object;
491                     }
492                 }
493 
494                 // nb_coerce took a reference.
495                 Py_DECREF(coerced1);
496                 Py_DECREF(coerced2);
497             }
498         }
499         coercion c2 =
500             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
501 
502         if (c2 != NULL) {
503             PyObject *coerced1 = operand1;
504             PyObject *coerced2 = operand2;
505 
506             int err = c2(&coerced2, &coerced1);
507 
508             if (unlikely(err < 0)) {
509                 goto exit_binary_exception;
510             }
511 
512             if (err == 0) {
513                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
514 
515                 if (likely(mv == NULL)) {
516                     binaryfunc slot = mv->nb_true_divide;
517 
518                     if (likely(slot != NULL)) {
519                         PyObject *x = slot(coerced1, coerced2);
520 
521                         Py_DECREF(coerced1);
522                         Py_DECREF(coerced2);
523 
524                         obj_result = x;
525                         goto exit_binary_result_object;
526                     }
527                 }
528 
529                 // nb_coerce took a reference.
530                 Py_DECREF(coerced1);
531                 Py_DECREF(coerced2);
532             }
533         }
534     }
535 #endif
536 
537     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'int' and '%s'", type2->tp_name);
538     goto exit_binary_exception;
539 
540 exit_binary_result_object:
541     return obj_result;
542 
543 exit_binary_exception:
544     return NULL;
545 }
_BINARY_OPERATION_TRUEDIV_OBJECT_INT_OBJECT(PyObject * operand1,PyObject * operand2)546 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
547     CHECK_OBJECT(operand1);
548     assert(PyInt_CheckExact(operand1));
549 #if PYTHON_VERSION < 0x300
550     assert(NEW_STYLE_NUMBER(operand1));
551 #endif
552     CHECK_OBJECT(operand2);
553 
554     PyTypeObject *type1 = &PyInt_Type;
555     PyTypeObject *type2 = Py_TYPE(operand2);
556 
557     if (type1 == type2) {
558         assert(type1 == type2);
559 
560         PyObject *result;
561 
562         // return _BINARY_OPERATION_TRUEDIV_OBJECT_INT_INT(operand1, operand2);
563 
564         // Not every code path will make use of all possible results.
565 #ifdef _MSC_VER
566 #pragma warning(push)
567 #pragma warning(disable : 4101)
568 #endif
569         NUITKA_MAY_BE_UNUSED bool cbool_result;
570         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
571         NUITKA_MAY_BE_UNUSED long clong_result;
572         NUITKA_MAY_BE_UNUSED double cfloat_result;
573 #ifdef _MSC_VER
574 #pragma warning(pop)
575 #endif
576 
577         CHECK_OBJECT(operand1);
578         assert(PyInt_CheckExact(operand1));
579 #if PYTHON_VERSION < 0x300
580         assert(NEW_STYLE_NUMBER(operand1));
581 #endif
582         CHECK_OBJECT(operand2);
583         assert(PyInt_CheckExact(operand2));
584 #if PYTHON_VERSION < 0x300
585         assert(NEW_STYLE_NUMBER(operand2));
586 #endif
587 
588         const long a = PyInt_AS_LONG(operand1);
589         const long b = PyInt_AS_LONG(operand2);
590 
591         if (unlikely(b == 0)) {
592             SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "division by zero");
593             goto exit_result_exception;
594         }
595 
596         if (a == 0) {
597             if (b < 0) {
598                 goto exit_result_ok_const_float_minus_0_0;
599             } else {
600                 goto exit_result_ok_const_float_0_0;
601             }
602         }
603 
604 /* May need to resort to LONG code, which we currently do not
605  * specialize yet. TODO: Once we do that, call it here instead.
606  */
607 #if DBL_MANT_DIG < WIDTH_OF_ULONG
608         if ((a >= 0 ? 0UL + a : 0UL - a) >> DBL_MANT_DIG || (b >= 0 ? 0UL + b : 0UL - b) >> DBL_MANT_DIG) {
609         } else
610 #endif
611         {
612             double r = (double)a / (double)b;
613 
614             cfloat_result = r;
615             goto exit_result_ok_cfloat;
616         }
617         {
618             PyObject *operand1_object = operand1;
619             PyObject *operand2_object = operand2;
620 
621             PyObject *r = PyLong_Type.tp_as_number->nb_true_divide(operand1_object, operand2_object);
622             assert(r != Py_NotImplemented);
623 
624             obj_result = r;
625             goto exit_result_object;
626         }
627 
628     exit_result_ok_cfloat:
629         result = PyFloat_FromDouble(cfloat_result);
630         goto exit_result_ok;
631 
632     exit_result_object:
633         if (unlikely(obj_result == NULL)) {
634             goto exit_result_exception;
635         }
636         result = obj_result;
637         goto exit_result_ok;
638 
639     exit_result_ok_const_float_0_0:
640         Py_INCREF(const_float_0_0);
641         result = const_float_0_0;
642         goto exit_result_ok;
643 
644     exit_result_ok_const_float_minus_0_0:
645         Py_INCREF(const_float_minus_0_0);
646         result = const_float_minus_0_0;
647         goto exit_result_ok;
648 
649     exit_result_ok:
650         return result;
651 
652     exit_result_exception:
653         return NULL;
654     }
655 
656     return __BINARY_OPERATION_TRUEDIV_OBJECT_INT_OBJECT(operand1, operand2);
657 }
658 
BINARY_OPERATION_TRUEDIV_OBJECT_INT_OBJECT(PyObject * operand1,PyObject * operand2)659 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
660     return _BINARY_OPERATION_TRUEDIV_OBJECT_INT_OBJECT(operand1, operand2);
661 }
662 #endif
663 
664 #if PYTHON_VERSION < 0x300
665 /* Code referring to "INT" corresponds to Python2 'int' and "INT" to Python2 'int'. */
_BINARY_OPERATION_TRUEDIV_NBOOL_INT_INT(PyObject * operand1,PyObject * operand2)666 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_INT_INT(PyObject *operand1, PyObject *operand2) {
667     CHECK_OBJECT(operand1);
668     assert(PyInt_CheckExact(operand1));
669 #if PYTHON_VERSION < 0x300
670     assert(NEW_STYLE_NUMBER(operand1));
671 #endif
672     CHECK_OBJECT(operand2);
673     assert(PyInt_CheckExact(operand2));
674 #if PYTHON_VERSION < 0x300
675     assert(NEW_STYLE_NUMBER(operand2));
676 #endif
677 
678     nuitka_bool result;
679 
680     // Not every code path will make use of all possible results.
681 #ifdef _MSC_VER
682 #pragma warning(push)
683 #pragma warning(disable : 4101)
684 #endif
685     NUITKA_MAY_BE_UNUSED bool cbool_result;
686     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
687     NUITKA_MAY_BE_UNUSED long clong_result;
688     NUITKA_MAY_BE_UNUSED double cfloat_result;
689 #ifdef _MSC_VER
690 #pragma warning(pop)
691 #endif
692 
693     CHECK_OBJECT(operand1);
694     assert(PyInt_CheckExact(operand1));
695 #if PYTHON_VERSION < 0x300
696     assert(NEW_STYLE_NUMBER(operand1));
697 #endif
698     CHECK_OBJECT(operand2);
699     assert(PyInt_CheckExact(operand2));
700 #if PYTHON_VERSION < 0x300
701     assert(NEW_STYLE_NUMBER(operand2));
702 #endif
703 
704     const long a = PyInt_AS_LONG(operand1);
705     const long b = PyInt_AS_LONG(operand2);
706 
707     if (unlikely(b == 0)) {
708         SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "division by zero");
709         goto exit_result_exception;
710     }
711 
712     cbool_result = a == 0;
713     goto exit_result_ok_cbool;
714 
715 exit_result_ok_cbool:
716     result = cbool_result ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
717     goto exit_result_ok;
718 
719 exit_result_ok:
720     return result;
721 
722 exit_result_exception:
723     return NUITKA_BOOL_EXCEPTION;
724 }
725 
BINARY_OPERATION_TRUEDIV_NBOOL_INT_INT(PyObject * operand1,PyObject * operand2)726 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_INT_INT(PyObject *operand1, PyObject *operand2) {
727     return _BINARY_OPERATION_TRUEDIV_NBOOL_INT_INT(operand1, operand2);
728 }
729 #endif
730 
731 #if PYTHON_VERSION < 0x300
732 /* Code referring to "OBJECT" corresponds to any Python object and "INT" to Python2 'int'. */
__BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_INT(PyObject * operand1,PyObject * operand2)733 static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_INT(PyObject *operand1,
734                                                                                    PyObject *operand2) {
735     PyTypeObject *type1 = Py_TYPE(operand1);
736     PyTypeObject *type2 = &PyInt_Type;
737 
738 #ifdef _MSC_VER
739 #pragma warning(push)
740 #pragma warning(disable : 4101)
741 #endif
742     NUITKA_MAY_BE_UNUSED bool cbool_result;
743     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
744 #ifdef _MSC_VER
745 #pragma warning(pop)
746 #endif
747 
748     binaryfunc slot1 =
749         (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
750     binaryfunc slot2 = NULL;
751 
752     if (!(type1 == type2)) {
753         assert(type1 != type2);
754         /* Different types, need to consider second value slot. */
755 
756         slot2 = PyInt_Type.tp_as_number->nb_true_divide;
757 
758         if (slot1 == slot2) {
759             slot2 = NULL;
760         }
761     }
762 
763     if (slot1 != NULL) {
764         PyObject *x = slot1(operand1, operand2);
765 
766         if (x != Py_NotImplemented) {
767             obj_result = x;
768             goto exit_binary_result_object;
769         }
770 
771         Py_DECREF(x);
772     }
773 
774     if (slot2 != NULL) {
775         PyObject *x = slot2(operand1, operand2);
776 
777         if (x != Py_NotImplemented) {
778             obj_result = x;
779             goto exit_binary_result_object;
780         }
781 
782         Py_DECREF(x);
783     }
784 
785 #if PYTHON_VERSION < 0x300
786     if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
787         coercion c1 =
788             (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
789 
790         if (c1 != NULL) {
791             PyObject *coerced1 = operand1;
792             PyObject *coerced2 = operand2;
793 
794             int err = c1(&coerced1, &coerced2);
795 
796             if (unlikely(err < 0)) {
797                 goto exit_binary_exception;
798             }
799 
800             if (err == 0) {
801                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
802 
803                 if (likely(mv == NULL)) {
804                     binaryfunc slot = mv->nb_true_divide;
805 
806                     if (likely(slot != NULL)) {
807                         PyObject *x = slot(coerced1, coerced2);
808 
809                         Py_DECREF(coerced1);
810                         Py_DECREF(coerced2);
811 
812                         obj_result = x;
813                         goto exit_binary_result_object;
814                     }
815                 }
816 
817                 // nb_coerce took a reference.
818                 Py_DECREF(coerced1);
819                 Py_DECREF(coerced2);
820             }
821         }
822         coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
823 
824         if (c2 != NULL) {
825             PyObject *coerced1 = operand1;
826             PyObject *coerced2 = operand2;
827 
828             int err = c2(&coerced2, &coerced1);
829 
830             if (unlikely(err < 0)) {
831                 goto exit_binary_exception;
832             }
833 
834             if (err == 0) {
835                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
836 
837                 if (likely(mv == NULL)) {
838                     binaryfunc slot = mv->nb_true_divide;
839 
840                     if (likely(slot != NULL)) {
841                         PyObject *x = slot(coerced1, coerced2);
842 
843                         Py_DECREF(coerced1);
844                         Py_DECREF(coerced2);
845 
846                         obj_result = x;
847                         goto exit_binary_result_object;
848                     }
849                 }
850 
851                 // nb_coerce took a reference.
852                 Py_DECREF(coerced1);
853                 Py_DECREF(coerced2);
854             }
855         }
856     }
857 #endif
858 
859     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and 'int'", type1->tp_name);
860     goto exit_binary_exception;
861 
862 exit_binary_result_object:
863     if (unlikely(obj_result == NULL)) {
864         return NUITKA_BOOL_EXCEPTION;
865     }
866 
867     {
868         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
869         Py_DECREF(obj_result);
870         return r;
871     }
872 
873 exit_binary_exception:
874     return NUITKA_BOOL_EXCEPTION;
875 }
_BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_INT(PyObject * operand1,PyObject * operand2)876 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
877     CHECK_OBJECT(operand1);
878     CHECK_OBJECT(operand2);
879     assert(PyInt_CheckExact(operand2));
880 #if PYTHON_VERSION < 0x300
881     assert(NEW_STYLE_NUMBER(operand2));
882 #endif
883 
884     PyTypeObject *type1 = Py_TYPE(operand1);
885     PyTypeObject *type2 = &PyInt_Type;
886 
887     if (type1 == type2) {
888         assert(type1 == type2);
889 
890         nuitka_bool result;
891 
892         // return _BINARY_OPERATION_TRUEDIV_NBOOL_INT_INT(operand1, operand2);
893 
894         // Not every code path will make use of all possible results.
895 #ifdef _MSC_VER
896 #pragma warning(push)
897 #pragma warning(disable : 4101)
898 #endif
899         NUITKA_MAY_BE_UNUSED bool cbool_result;
900         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
901         NUITKA_MAY_BE_UNUSED long clong_result;
902         NUITKA_MAY_BE_UNUSED double cfloat_result;
903 #ifdef _MSC_VER
904 #pragma warning(pop)
905 #endif
906 
907         CHECK_OBJECT(operand1);
908         assert(PyInt_CheckExact(operand1));
909 #if PYTHON_VERSION < 0x300
910         assert(NEW_STYLE_NUMBER(operand1));
911 #endif
912         CHECK_OBJECT(operand2);
913         assert(PyInt_CheckExact(operand2));
914 #if PYTHON_VERSION < 0x300
915         assert(NEW_STYLE_NUMBER(operand2));
916 #endif
917 
918         const long a = PyInt_AS_LONG(operand1);
919         const long b = PyInt_AS_LONG(operand2);
920 
921         if (unlikely(b == 0)) {
922             SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "division by zero");
923             goto exit_result_exception;
924         }
925 
926         cbool_result = a == 0;
927         goto exit_result_ok_cbool;
928 
929     exit_result_ok_cbool:
930         result = cbool_result ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
931         goto exit_result_ok;
932 
933     exit_result_ok:
934         return result;
935 
936     exit_result_exception:
937         return NUITKA_BOOL_EXCEPTION;
938     }
939 
940     return __BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_INT(operand1, operand2);
941 }
942 
BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_INT(PyObject * operand1,PyObject * operand2)943 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
944     return _BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_INT(operand1, operand2);
945 }
946 #endif
947 
948 #if PYTHON_VERSION < 0x300
949 /* Code referring to "INT" corresponds to Python2 'int' and "OBJECT" to any Python object. */
__BINARY_OPERATION_TRUEDIV_NBOOL_INT_OBJECT(PyObject * operand1,PyObject * operand2)950 static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_TRUEDIV_NBOOL_INT_OBJECT(PyObject *operand1,
951                                                                                    PyObject *operand2) {
952     PyTypeObject *type1 = &PyInt_Type;
953     PyTypeObject *type2 = Py_TYPE(operand2);
954 
955 #ifdef _MSC_VER
956 #pragma warning(push)
957 #pragma warning(disable : 4101)
958 #endif
959     NUITKA_MAY_BE_UNUSED bool cbool_result;
960     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
961 #ifdef _MSC_VER
962 #pragma warning(pop)
963 #endif
964 
965     binaryfunc slot1 = PyInt_Type.tp_as_number->nb_true_divide;
966     binaryfunc slot2 = NULL;
967 
968     if (!(type1 == type2)) {
969         assert(type1 != type2);
970         /* Different types, need to consider second value slot. */
971 
972         slot2 =
973             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide : NULL;
974 
975         if (slot1 == slot2) {
976             slot2 = NULL;
977         }
978     }
979 
980     if (slot1 != NULL) {
981         if (slot2 != NULL) {
982             if (PyType_IsSubtype(type2, type1)) {
983                 PyObject *x = slot2(operand1, operand2);
984 
985                 if (x != Py_NotImplemented) {
986                     obj_result = x;
987                     goto exit_binary_result_object;
988                 }
989 
990                 Py_DECREF(x);
991                 slot2 = NULL;
992             }
993         }
994 
995         PyObject *x = slot1(operand1, operand2);
996 
997         if (x != Py_NotImplemented) {
998             obj_result = x;
999             goto exit_binary_result_object;
1000         }
1001 
1002         Py_DECREF(x);
1003     }
1004 
1005     if (slot2 != NULL) {
1006         PyObject *x = slot2(operand1, operand2);
1007 
1008         if (x != Py_NotImplemented) {
1009             obj_result = x;
1010             goto exit_binary_result_object;
1011         }
1012 
1013         Py_DECREF(x);
1014     }
1015 
1016 #if PYTHON_VERSION < 0x300
1017     if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1018         coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
1019 
1020         if (c1 != NULL) {
1021             PyObject *coerced1 = operand1;
1022             PyObject *coerced2 = operand2;
1023 
1024             int err = c1(&coerced1, &coerced2);
1025 
1026             if (unlikely(err < 0)) {
1027                 goto exit_binary_exception;
1028             }
1029 
1030             if (err == 0) {
1031                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1032 
1033                 if (likely(mv == NULL)) {
1034                     binaryfunc slot = mv->nb_true_divide;
1035 
1036                     if (likely(slot != NULL)) {
1037                         PyObject *x = slot(coerced1, coerced2);
1038 
1039                         Py_DECREF(coerced1);
1040                         Py_DECREF(coerced2);
1041 
1042                         obj_result = x;
1043                         goto exit_binary_result_object;
1044                     }
1045                 }
1046 
1047                 // nb_coerce took a reference.
1048                 Py_DECREF(coerced1);
1049                 Py_DECREF(coerced2);
1050             }
1051         }
1052         coercion c2 =
1053             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1054 
1055         if (c2 != NULL) {
1056             PyObject *coerced1 = operand1;
1057             PyObject *coerced2 = operand2;
1058 
1059             int err = c2(&coerced2, &coerced1);
1060 
1061             if (unlikely(err < 0)) {
1062                 goto exit_binary_exception;
1063             }
1064 
1065             if (err == 0) {
1066                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1067 
1068                 if (likely(mv == NULL)) {
1069                     binaryfunc slot = mv->nb_true_divide;
1070 
1071                     if (likely(slot != NULL)) {
1072                         PyObject *x = slot(coerced1, coerced2);
1073 
1074                         Py_DECREF(coerced1);
1075                         Py_DECREF(coerced2);
1076 
1077                         obj_result = x;
1078                         goto exit_binary_result_object;
1079                     }
1080                 }
1081 
1082                 // nb_coerce took a reference.
1083                 Py_DECREF(coerced1);
1084                 Py_DECREF(coerced2);
1085             }
1086         }
1087     }
1088 #endif
1089 
1090     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'int' and '%s'", type2->tp_name);
1091     goto exit_binary_exception;
1092 
1093 exit_binary_result_object:
1094     if (unlikely(obj_result == NULL)) {
1095         return NUITKA_BOOL_EXCEPTION;
1096     }
1097 
1098     {
1099         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1100         Py_DECREF(obj_result);
1101         return r;
1102     }
1103 
1104 exit_binary_exception:
1105     return NUITKA_BOOL_EXCEPTION;
1106 }
_BINARY_OPERATION_TRUEDIV_NBOOL_INT_OBJECT(PyObject * operand1,PyObject * operand2)1107 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
1108     CHECK_OBJECT(operand1);
1109     assert(PyInt_CheckExact(operand1));
1110 #if PYTHON_VERSION < 0x300
1111     assert(NEW_STYLE_NUMBER(operand1));
1112 #endif
1113     CHECK_OBJECT(operand2);
1114 
1115     PyTypeObject *type1 = &PyInt_Type;
1116     PyTypeObject *type2 = Py_TYPE(operand2);
1117 
1118     if (type1 == type2) {
1119         assert(type1 == type2);
1120 
1121         nuitka_bool result;
1122 
1123         // return _BINARY_OPERATION_TRUEDIV_NBOOL_INT_INT(operand1, operand2);
1124 
1125         // Not every code path will make use of all possible results.
1126 #ifdef _MSC_VER
1127 #pragma warning(push)
1128 #pragma warning(disable : 4101)
1129 #endif
1130         NUITKA_MAY_BE_UNUSED bool cbool_result;
1131         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1132         NUITKA_MAY_BE_UNUSED long clong_result;
1133         NUITKA_MAY_BE_UNUSED double cfloat_result;
1134 #ifdef _MSC_VER
1135 #pragma warning(pop)
1136 #endif
1137 
1138         CHECK_OBJECT(operand1);
1139         assert(PyInt_CheckExact(operand1));
1140 #if PYTHON_VERSION < 0x300
1141         assert(NEW_STYLE_NUMBER(operand1));
1142 #endif
1143         CHECK_OBJECT(operand2);
1144         assert(PyInt_CheckExact(operand2));
1145 #if PYTHON_VERSION < 0x300
1146         assert(NEW_STYLE_NUMBER(operand2));
1147 #endif
1148 
1149         const long a = PyInt_AS_LONG(operand1);
1150         const long b = PyInt_AS_LONG(operand2);
1151 
1152         if (unlikely(b == 0)) {
1153             SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "division by zero");
1154             goto exit_result_exception;
1155         }
1156 
1157         cbool_result = a == 0;
1158         goto exit_result_ok_cbool;
1159 
1160     exit_result_ok_cbool:
1161         result = cbool_result ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1162         goto exit_result_ok;
1163 
1164     exit_result_ok:
1165         return result;
1166 
1167     exit_result_exception:
1168         return NUITKA_BOOL_EXCEPTION;
1169     }
1170 
1171     return __BINARY_OPERATION_TRUEDIV_NBOOL_INT_OBJECT(operand1, operand2);
1172 }
1173 
BINARY_OPERATION_TRUEDIV_NBOOL_INT_OBJECT(PyObject * operand1,PyObject * operand2)1174 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
1175     return _BINARY_OPERATION_TRUEDIV_NBOOL_INT_OBJECT(operand1, operand2);
1176 }
1177 #endif
1178 
1179 /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "LONG" to Python2 'long', Python3 'int'. */
_BINARY_OPERATION_TRUEDIV_OBJECT_LONG_LONG(PyObject * operand1,PyObject * operand2)1180 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_LONG_LONG(PyObject *operand1, PyObject *operand2) {
1181     CHECK_OBJECT(operand1);
1182     assert(PyLong_CheckExact(operand1));
1183 #if PYTHON_VERSION < 0x300
1184     assert(NEW_STYLE_NUMBER(operand1));
1185 #endif
1186     CHECK_OBJECT(operand2);
1187     assert(PyLong_CheckExact(operand2));
1188 #if PYTHON_VERSION < 0x300
1189     assert(NEW_STYLE_NUMBER(operand2));
1190 #endif
1191 
1192     PyObject *result;
1193 
1194     // Not every code path will make use of all possible results.
1195     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1196 
1197     PyObject *x = PyLong_Type.tp_as_number->nb_true_divide(operand1, operand2);
1198     assert(x != Py_NotImplemented);
1199 
1200     obj_result = x;
1201     goto exit_result_object;
1202 
1203 exit_result_object:
1204     if (unlikely(obj_result == NULL)) {
1205         goto exit_result_exception;
1206     }
1207     result = obj_result;
1208     goto exit_result_ok;
1209 
1210 exit_result_ok:
1211     return result;
1212 
1213 exit_result_exception:
1214     return NULL;
1215 }
1216 
BINARY_OPERATION_TRUEDIV_OBJECT_LONG_LONG(PyObject * operand1,PyObject * operand2)1217 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_LONG_LONG(PyObject *operand1, PyObject *operand2) {
1218     return _BINARY_OPERATION_TRUEDIV_OBJECT_LONG_LONG(operand1, operand2);
1219 }
1220 
1221 /* Code referring to "OBJECT" corresponds to any Python object and "LONG" to Python2 'long', Python3 'int'. */
__BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_LONG(PyObject * operand1,PyObject * operand2)1222 static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_LONG(PyObject *operand1,
1223                                                                                    PyObject *operand2) {
1224     PyTypeObject *type1 = Py_TYPE(operand1);
1225     PyTypeObject *type2 = &PyLong_Type;
1226 
1227 #ifdef _MSC_VER
1228 #pragma warning(push)
1229 #pragma warning(disable : 4101)
1230 #endif
1231     NUITKA_MAY_BE_UNUSED bool cbool_result;
1232     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1233 #ifdef _MSC_VER
1234 #pragma warning(pop)
1235 #endif
1236 
1237     binaryfunc slot1 =
1238         (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
1239     binaryfunc slot2 = NULL;
1240 
1241     if (!(type1 == type2)) {
1242         assert(type1 != type2);
1243         /* Different types, need to consider second value slot. */
1244 
1245         slot2 = PyLong_Type.tp_as_number->nb_true_divide;
1246 
1247         if (slot1 == slot2) {
1248             slot2 = NULL;
1249         }
1250     }
1251 
1252     if (slot1 != NULL) {
1253         PyObject *x = slot1(operand1, operand2);
1254 
1255         if (x != Py_NotImplemented) {
1256             obj_result = x;
1257             goto exit_binary_result_object;
1258         }
1259 
1260         Py_DECREF(x);
1261     }
1262 
1263     if (slot2 != NULL) {
1264         PyObject *x = slot2(operand1, operand2);
1265 
1266         if (x != Py_NotImplemented) {
1267             obj_result = x;
1268             goto exit_binary_result_object;
1269         }
1270 
1271         Py_DECREF(x);
1272     }
1273 
1274 #if PYTHON_VERSION < 0x300
1275     if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1276         coercion c1 =
1277             (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1278 
1279         if (c1 != NULL) {
1280             PyObject *coerced1 = operand1;
1281             PyObject *coerced2 = operand2;
1282 
1283             int err = c1(&coerced1, &coerced2);
1284 
1285             if (unlikely(err < 0)) {
1286                 goto exit_binary_exception;
1287             }
1288 
1289             if (err == 0) {
1290                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1291 
1292                 if (likely(mv == NULL)) {
1293                     binaryfunc slot = mv->nb_true_divide;
1294 
1295                     if (likely(slot != NULL)) {
1296                         PyObject *x = slot(coerced1, coerced2);
1297 
1298                         Py_DECREF(coerced1);
1299                         Py_DECREF(coerced2);
1300 
1301                         obj_result = x;
1302                         goto exit_binary_result_object;
1303                     }
1304                 }
1305 
1306                 // nb_coerce took a reference.
1307                 Py_DECREF(coerced1);
1308                 Py_DECREF(coerced2);
1309             }
1310         }
1311         coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
1312 
1313         if (c2 != NULL) {
1314             PyObject *coerced1 = operand1;
1315             PyObject *coerced2 = operand2;
1316 
1317             int err = c2(&coerced2, &coerced1);
1318 
1319             if (unlikely(err < 0)) {
1320                 goto exit_binary_exception;
1321             }
1322 
1323             if (err == 0) {
1324                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1325 
1326                 if (likely(mv == NULL)) {
1327                     binaryfunc slot = mv->nb_true_divide;
1328 
1329                     if (likely(slot != NULL)) {
1330                         PyObject *x = slot(coerced1, coerced2);
1331 
1332                         Py_DECREF(coerced1);
1333                         Py_DECREF(coerced2);
1334 
1335                         obj_result = x;
1336                         goto exit_binary_result_object;
1337                     }
1338                 }
1339 
1340                 // nb_coerce took a reference.
1341                 Py_DECREF(coerced1);
1342                 Py_DECREF(coerced2);
1343             }
1344         }
1345     }
1346 #endif
1347 
1348 #if PYTHON_VERSION < 0x300
1349     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and 'long'", type1->tp_name);
1350 #else
1351     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and 'int'", type1->tp_name);
1352 #endif
1353     goto exit_binary_exception;
1354 
1355 exit_binary_result_object:
1356     return obj_result;
1357 
1358 exit_binary_exception:
1359     return NULL;
1360 }
_BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_LONG(PyObject * operand1,PyObject * operand2)1361 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
1362     CHECK_OBJECT(operand1);
1363     CHECK_OBJECT(operand2);
1364     assert(PyLong_CheckExact(operand2));
1365 #if PYTHON_VERSION < 0x300
1366     assert(NEW_STYLE_NUMBER(operand2));
1367 #endif
1368 
1369     PyTypeObject *type1 = Py_TYPE(operand1);
1370     PyTypeObject *type2 = &PyLong_Type;
1371 
1372     if (type1 == type2) {
1373         assert(type1 == type2);
1374 
1375         PyObject *result;
1376 
1377         // return _BINARY_OPERATION_TRUEDIV_OBJECT_LONG_LONG(operand1, operand2);
1378 
1379         // Not every code path will make use of all possible results.
1380         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1381 
1382         PyObject *x = PyLong_Type.tp_as_number->nb_true_divide(operand1, operand2);
1383         assert(x != Py_NotImplemented);
1384 
1385         obj_result = x;
1386         goto exit_result_object;
1387 
1388     exit_result_object:
1389         if (unlikely(obj_result == NULL)) {
1390             goto exit_result_exception;
1391         }
1392         result = obj_result;
1393         goto exit_result_ok;
1394 
1395     exit_result_ok:
1396         return result;
1397 
1398     exit_result_exception:
1399         return NULL;
1400     }
1401 
1402     return __BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_LONG(operand1, operand2);
1403 }
1404 
BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_LONG(PyObject * operand1,PyObject * operand2)1405 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
1406     return _BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_LONG(operand1, operand2);
1407 }
1408 
1409 /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "OBJECT" to any Python object. */
__BINARY_OPERATION_TRUEDIV_OBJECT_LONG_OBJECT(PyObject * operand1,PyObject * operand2)1410 static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_TRUEDIV_OBJECT_LONG_OBJECT(PyObject *operand1,
1411                                                                                    PyObject *operand2) {
1412     PyTypeObject *type1 = &PyLong_Type;
1413     PyTypeObject *type2 = Py_TYPE(operand2);
1414 
1415 #ifdef _MSC_VER
1416 #pragma warning(push)
1417 #pragma warning(disable : 4101)
1418 #endif
1419     NUITKA_MAY_BE_UNUSED bool cbool_result;
1420     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1421 #ifdef _MSC_VER
1422 #pragma warning(pop)
1423 #endif
1424 
1425     binaryfunc slot1 = PyLong_Type.tp_as_number->nb_true_divide;
1426     binaryfunc slot2 = NULL;
1427 
1428     if (!(type1 == type2)) {
1429         assert(type1 != type2);
1430         /* Different types, need to consider second value slot. */
1431 
1432         slot2 =
1433             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide : NULL;
1434 
1435         if (slot1 == slot2) {
1436             slot2 = NULL;
1437         }
1438     }
1439 
1440     if (slot1 != NULL) {
1441         if (slot2 != NULL) {
1442             if (PyType_IsSubtype(type2, type1)) {
1443                 PyObject *x = slot2(operand1, operand2);
1444 
1445                 if (x != Py_NotImplemented) {
1446                     obj_result = x;
1447                     goto exit_binary_result_object;
1448                 }
1449 
1450                 Py_DECREF(x);
1451                 slot2 = NULL;
1452             }
1453         }
1454 
1455         PyObject *x = slot1(operand1, operand2);
1456 
1457         if (x != Py_NotImplemented) {
1458             obj_result = x;
1459             goto exit_binary_result_object;
1460         }
1461 
1462         Py_DECREF(x);
1463     }
1464 
1465     if (slot2 != NULL) {
1466         PyObject *x = slot2(operand1, operand2);
1467 
1468         if (x != Py_NotImplemented) {
1469             obj_result = x;
1470             goto exit_binary_result_object;
1471         }
1472 
1473         Py_DECREF(x);
1474     }
1475 
1476 #if PYTHON_VERSION < 0x300
1477     if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1478         coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
1479 
1480         if (c1 != NULL) {
1481             PyObject *coerced1 = operand1;
1482             PyObject *coerced2 = operand2;
1483 
1484             int err = c1(&coerced1, &coerced2);
1485 
1486             if (unlikely(err < 0)) {
1487                 goto exit_binary_exception;
1488             }
1489 
1490             if (err == 0) {
1491                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1492 
1493                 if (likely(mv == NULL)) {
1494                     binaryfunc slot = mv->nb_true_divide;
1495 
1496                     if (likely(slot != NULL)) {
1497                         PyObject *x = slot(coerced1, coerced2);
1498 
1499                         Py_DECREF(coerced1);
1500                         Py_DECREF(coerced2);
1501 
1502                         obj_result = x;
1503                         goto exit_binary_result_object;
1504                     }
1505                 }
1506 
1507                 // nb_coerce took a reference.
1508                 Py_DECREF(coerced1);
1509                 Py_DECREF(coerced2);
1510             }
1511         }
1512         coercion c2 =
1513             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1514 
1515         if (c2 != NULL) {
1516             PyObject *coerced1 = operand1;
1517             PyObject *coerced2 = operand2;
1518 
1519             int err = c2(&coerced2, &coerced1);
1520 
1521             if (unlikely(err < 0)) {
1522                 goto exit_binary_exception;
1523             }
1524 
1525             if (err == 0) {
1526                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1527 
1528                 if (likely(mv == NULL)) {
1529                     binaryfunc slot = mv->nb_true_divide;
1530 
1531                     if (likely(slot != NULL)) {
1532                         PyObject *x = slot(coerced1, coerced2);
1533 
1534                         Py_DECREF(coerced1);
1535                         Py_DECREF(coerced2);
1536 
1537                         obj_result = x;
1538                         goto exit_binary_result_object;
1539                     }
1540                 }
1541 
1542                 // nb_coerce took a reference.
1543                 Py_DECREF(coerced1);
1544                 Py_DECREF(coerced2);
1545             }
1546         }
1547     }
1548 #endif
1549 
1550 #if PYTHON_VERSION < 0x300
1551     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'long' and '%s'", type2->tp_name);
1552 #else
1553     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'int' and '%s'", type2->tp_name);
1554 #endif
1555     goto exit_binary_exception;
1556 
1557 exit_binary_result_object:
1558     return obj_result;
1559 
1560 exit_binary_exception:
1561     return NULL;
1562 }
_BINARY_OPERATION_TRUEDIV_OBJECT_LONG_OBJECT(PyObject * operand1,PyObject * operand2)1563 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
1564     CHECK_OBJECT(operand1);
1565     assert(PyLong_CheckExact(operand1));
1566 #if PYTHON_VERSION < 0x300
1567     assert(NEW_STYLE_NUMBER(operand1));
1568 #endif
1569     CHECK_OBJECT(operand2);
1570 
1571     PyTypeObject *type1 = &PyLong_Type;
1572     PyTypeObject *type2 = Py_TYPE(operand2);
1573 
1574     if (type1 == type2) {
1575         assert(type1 == type2);
1576 
1577         PyObject *result;
1578 
1579         // return _BINARY_OPERATION_TRUEDIV_OBJECT_LONG_LONG(operand1, operand2);
1580 
1581         // Not every code path will make use of all possible results.
1582         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1583 
1584         PyObject *x = PyLong_Type.tp_as_number->nb_true_divide(operand1, operand2);
1585         assert(x != Py_NotImplemented);
1586 
1587         obj_result = x;
1588         goto exit_result_object;
1589 
1590     exit_result_object:
1591         if (unlikely(obj_result == NULL)) {
1592             goto exit_result_exception;
1593         }
1594         result = obj_result;
1595         goto exit_result_ok;
1596 
1597     exit_result_ok:
1598         return result;
1599 
1600     exit_result_exception:
1601         return NULL;
1602     }
1603 
1604     return __BINARY_OPERATION_TRUEDIV_OBJECT_LONG_OBJECT(operand1, operand2);
1605 }
1606 
BINARY_OPERATION_TRUEDIV_OBJECT_LONG_OBJECT(PyObject * operand1,PyObject * operand2)1607 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
1608     return _BINARY_OPERATION_TRUEDIV_OBJECT_LONG_OBJECT(operand1, operand2);
1609 }
1610 
1611 /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "LONG" to Python2 'long', Python3 'int'. */
_BINARY_OPERATION_TRUEDIV_NBOOL_LONG_LONG(PyObject * operand1,PyObject * operand2)1612 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
1613     CHECK_OBJECT(operand1);
1614     assert(PyLong_CheckExact(operand1));
1615 #if PYTHON_VERSION < 0x300
1616     assert(NEW_STYLE_NUMBER(operand1));
1617 #endif
1618     CHECK_OBJECT(operand2);
1619     assert(PyLong_CheckExact(operand2));
1620 #if PYTHON_VERSION < 0x300
1621     assert(NEW_STYLE_NUMBER(operand2));
1622 #endif
1623 
1624     nuitka_bool result;
1625 
1626     // Not every code path will make use of all possible results.
1627     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1628 
1629     PyObject *x = PyLong_Type.tp_as_number->nb_true_divide(operand1, operand2);
1630     assert(x != Py_NotImplemented);
1631 
1632     obj_result = x;
1633     goto exit_result_object;
1634 
1635 exit_result_object:
1636     if (unlikely(obj_result == NULL)) {
1637         goto exit_result_exception;
1638     }
1639     result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1640     Py_DECREF(obj_result);
1641     goto exit_result_ok;
1642 
1643 exit_result_ok:
1644     return result;
1645 
1646 exit_result_exception:
1647     return NUITKA_BOOL_EXCEPTION;
1648 }
1649 
BINARY_OPERATION_TRUEDIV_NBOOL_LONG_LONG(PyObject * operand1,PyObject * operand2)1650 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
1651     return _BINARY_OPERATION_TRUEDIV_NBOOL_LONG_LONG(operand1, operand2);
1652 }
1653 
1654 /* Code referring to "OBJECT" corresponds to any Python object and "LONG" to Python2 'long', Python3 'int'. */
__BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_LONG(PyObject * operand1,PyObject * operand2)1655 static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_LONG(PyObject *operand1,
1656                                                                                     PyObject *operand2) {
1657     PyTypeObject *type1 = Py_TYPE(operand1);
1658     PyTypeObject *type2 = &PyLong_Type;
1659 
1660 #ifdef _MSC_VER
1661 #pragma warning(push)
1662 #pragma warning(disable : 4101)
1663 #endif
1664     NUITKA_MAY_BE_UNUSED bool cbool_result;
1665     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1666 #ifdef _MSC_VER
1667 #pragma warning(pop)
1668 #endif
1669 
1670     binaryfunc slot1 =
1671         (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
1672     binaryfunc slot2 = NULL;
1673 
1674     if (!(type1 == type2)) {
1675         assert(type1 != type2);
1676         /* Different types, need to consider second value slot. */
1677 
1678         slot2 = PyLong_Type.tp_as_number->nb_true_divide;
1679 
1680         if (slot1 == slot2) {
1681             slot2 = NULL;
1682         }
1683     }
1684 
1685     if (slot1 != NULL) {
1686         PyObject *x = slot1(operand1, operand2);
1687 
1688         if (x != Py_NotImplemented) {
1689             obj_result = x;
1690             goto exit_binary_result_object;
1691         }
1692 
1693         Py_DECREF(x);
1694     }
1695 
1696     if (slot2 != NULL) {
1697         PyObject *x = slot2(operand1, operand2);
1698 
1699         if (x != Py_NotImplemented) {
1700             obj_result = x;
1701             goto exit_binary_result_object;
1702         }
1703 
1704         Py_DECREF(x);
1705     }
1706 
1707 #if PYTHON_VERSION < 0x300
1708     if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1709         coercion c1 =
1710             (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1711 
1712         if (c1 != NULL) {
1713             PyObject *coerced1 = operand1;
1714             PyObject *coerced2 = operand2;
1715 
1716             int err = c1(&coerced1, &coerced2);
1717 
1718             if (unlikely(err < 0)) {
1719                 goto exit_binary_exception;
1720             }
1721 
1722             if (err == 0) {
1723                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1724 
1725                 if (likely(mv == NULL)) {
1726                     binaryfunc slot = mv->nb_true_divide;
1727 
1728                     if (likely(slot != NULL)) {
1729                         PyObject *x = slot(coerced1, coerced2);
1730 
1731                         Py_DECREF(coerced1);
1732                         Py_DECREF(coerced2);
1733 
1734                         obj_result = x;
1735                         goto exit_binary_result_object;
1736                     }
1737                 }
1738 
1739                 // nb_coerce took a reference.
1740                 Py_DECREF(coerced1);
1741                 Py_DECREF(coerced2);
1742             }
1743         }
1744         coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
1745 
1746         if (c2 != NULL) {
1747             PyObject *coerced1 = operand1;
1748             PyObject *coerced2 = operand2;
1749 
1750             int err = c2(&coerced2, &coerced1);
1751 
1752             if (unlikely(err < 0)) {
1753                 goto exit_binary_exception;
1754             }
1755 
1756             if (err == 0) {
1757                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1758 
1759                 if (likely(mv == NULL)) {
1760                     binaryfunc slot = mv->nb_true_divide;
1761 
1762                     if (likely(slot != NULL)) {
1763                         PyObject *x = slot(coerced1, coerced2);
1764 
1765                         Py_DECREF(coerced1);
1766                         Py_DECREF(coerced2);
1767 
1768                         obj_result = x;
1769                         goto exit_binary_result_object;
1770                     }
1771                 }
1772 
1773                 // nb_coerce took a reference.
1774                 Py_DECREF(coerced1);
1775                 Py_DECREF(coerced2);
1776             }
1777         }
1778     }
1779 #endif
1780 
1781 #if PYTHON_VERSION < 0x300
1782     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and 'long'", type1->tp_name);
1783 #else
1784     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and 'int'", type1->tp_name);
1785 #endif
1786     goto exit_binary_exception;
1787 
1788 exit_binary_result_object:
1789     if (unlikely(obj_result == NULL)) {
1790         return NUITKA_BOOL_EXCEPTION;
1791     }
1792 
1793     {
1794         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1795         Py_DECREF(obj_result);
1796         return r;
1797     }
1798 
1799 exit_binary_exception:
1800     return NUITKA_BOOL_EXCEPTION;
1801 }
_BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_LONG(PyObject * operand1,PyObject * operand2)1802 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
1803     CHECK_OBJECT(operand1);
1804     CHECK_OBJECT(operand2);
1805     assert(PyLong_CheckExact(operand2));
1806 #if PYTHON_VERSION < 0x300
1807     assert(NEW_STYLE_NUMBER(operand2));
1808 #endif
1809 
1810     PyTypeObject *type1 = Py_TYPE(operand1);
1811     PyTypeObject *type2 = &PyLong_Type;
1812 
1813     if (type1 == type2) {
1814         assert(type1 == type2);
1815 
1816         nuitka_bool result;
1817 
1818         // return _BINARY_OPERATION_TRUEDIV_NBOOL_LONG_LONG(operand1, operand2);
1819 
1820         // Not every code path will make use of all possible results.
1821         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1822 
1823         PyObject *x = PyLong_Type.tp_as_number->nb_true_divide(operand1, operand2);
1824         assert(x != Py_NotImplemented);
1825 
1826         obj_result = x;
1827         goto exit_result_object;
1828 
1829     exit_result_object:
1830         if (unlikely(obj_result == NULL)) {
1831             goto exit_result_exception;
1832         }
1833         result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1834         Py_DECREF(obj_result);
1835         goto exit_result_ok;
1836 
1837     exit_result_ok:
1838         return result;
1839 
1840     exit_result_exception:
1841         return NUITKA_BOOL_EXCEPTION;
1842     }
1843 
1844     return __BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_LONG(operand1, operand2);
1845 }
1846 
BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_LONG(PyObject * operand1,PyObject * operand2)1847 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
1848     return _BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_LONG(operand1, operand2);
1849 }
1850 
1851 /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "OBJECT" to any Python object. */
__BINARY_OPERATION_TRUEDIV_NBOOL_LONG_OBJECT(PyObject * operand1,PyObject * operand2)1852 static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_TRUEDIV_NBOOL_LONG_OBJECT(PyObject *operand1,
1853                                                                                     PyObject *operand2) {
1854     PyTypeObject *type1 = &PyLong_Type;
1855     PyTypeObject *type2 = Py_TYPE(operand2);
1856 
1857 #ifdef _MSC_VER
1858 #pragma warning(push)
1859 #pragma warning(disable : 4101)
1860 #endif
1861     NUITKA_MAY_BE_UNUSED bool cbool_result;
1862     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1863 #ifdef _MSC_VER
1864 #pragma warning(pop)
1865 #endif
1866 
1867     binaryfunc slot1 = PyLong_Type.tp_as_number->nb_true_divide;
1868     binaryfunc slot2 = NULL;
1869 
1870     if (!(type1 == type2)) {
1871         assert(type1 != type2);
1872         /* Different types, need to consider second value slot. */
1873 
1874         slot2 =
1875             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide : NULL;
1876 
1877         if (slot1 == slot2) {
1878             slot2 = NULL;
1879         }
1880     }
1881 
1882     if (slot1 != NULL) {
1883         if (slot2 != NULL) {
1884             if (PyType_IsSubtype(type2, type1)) {
1885                 PyObject *x = slot2(operand1, operand2);
1886 
1887                 if (x != Py_NotImplemented) {
1888                     obj_result = x;
1889                     goto exit_binary_result_object;
1890                 }
1891 
1892                 Py_DECREF(x);
1893                 slot2 = NULL;
1894             }
1895         }
1896 
1897         PyObject *x = slot1(operand1, operand2);
1898 
1899         if (x != Py_NotImplemented) {
1900             obj_result = x;
1901             goto exit_binary_result_object;
1902         }
1903 
1904         Py_DECREF(x);
1905     }
1906 
1907     if (slot2 != NULL) {
1908         PyObject *x = slot2(operand1, operand2);
1909 
1910         if (x != Py_NotImplemented) {
1911             obj_result = x;
1912             goto exit_binary_result_object;
1913         }
1914 
1915         Py_DECREF(x);
1916     }
1917 
1918 #if PYTHON_VERSION < 0x300
1919     if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1920         coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
1921 
1922         if (c1 != NULL) {
1923             PyObject *coerced1 = operand1;
1924             PyObject *coerced2 = operand2;
1925 
1926             int err = c1(&coerced1, &coerced2);
1927 
1928             if (unlikely(err < 0)) {
1929                 goto exit_binary_exception;
1930             }
1931 
1932             if (err == 0) {
1933                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1934 
1935                 if (likely(mv == NULL)) {
1936                     binaryfunc slot = mv->nb_true_divide;
1937 
1938                     if (likely(slot != NULL)) {
1939                         PyObject *x = slot(coerced1, coerced2);
1940 
1941                         Py_DECREF(coerced1);
1942                         Py_DECREF(coerced2);
1943 
1944                         obj_result = x;
1945                         goto exit_binary_result_object;
1946                     }
1947                 }
1948 
1949                 // nb_coerce took a reference.
1950                 Py_DECREF(coerced1);
1951                 Py_DECREF(coerced2);
1952             }
1953         }
1954         coercion c2 =
1955             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1956 
1957         if (c2 != NULL) {
1958             PyObject *coerced1 = operand1;
1959             PyObject *coerced2 = operand2;
1960 
1961             int err = c2(&coerced2, &coerced1);
1962 
1963             if (unlikely(err < 0)) {
1964                 goto exit_binary_exception;
1965             }
1966 
1967             if (err == 0) {
1968                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1969 
1970                 if (likely(mv == NULL)) {
1971                     binaryfunc slot = mv->nb_true_divide;
1972 
1973                     if (likely(slot != NULL)) {
1974                         PyObject *x = slot(coerced1, coerced2);
1975 
1976                         Py_DECREF(coerced1);
1977                         Py_DECREF(coerced2);
1978 
1979                         obj_result = x;
1980                         goto exit_binary_result_object;
1981                     }
1982                 }
1983 
1984                 // nb_coerce took a reference.
1985                 Py_DECREF(coerced1);
1986                 Py_DECREF(coerced2);
1987             }
1988         }
1989     }
1990 #endif
1991 
1992 #if PYTHON_VERSION < 0x300
1993     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'long' and '%s'", type2->tp_name);
1994 #else
1995     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'int' and '%s'", type2->tp_name);
1996 #endif
1997     goto exit_binary_exception;
1998 
1999 exit_binary_result_object:
2000     if (unlikely(obj_result == NULL)) {
2001         return NUITKA_BOOL_EXCEPTION;
2002     }
2003 
2004     {
2005         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2006         Py_DECREF(obj_result);
2007         return r;
2008     }
2009 
2010 exit_binary_exception:
2011     return NUITKA_BOOL_EXCEPTION;
2012 }
_BINARY_OPERATION_TRUEDIV_NBOOL_LONG_OBJECT(PyObject * operand1,PyObject * operand2)2013 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
2014     CHECK_OBJECT(operand1);
2015     assert(PyLong_CheckExact(operand1));
2016 #if PYTHON_VERSION < 0x300
2017     assert(NEW_STYLE_NUMBER(operand1));
2018 #endif
2019     CHECK_OBJECT(operand2);
2020 
2021     PyTypeObject *type1 = &PyLong_Type;
2022     PyTypeObject *type2 = Py_TYPE(operand2);
2023 
2024     if (type1 == type2) {
2025         assert(type1 == type2);
2026 
2027         nuitka_bool result;
2028 
2029         // return _BINARY_OPERATION_TRUEDIV_NBOOL_LONG_LONG(operand1, operand2);
2030 
2031         // Not every code path will make use of all possible results.
2032         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2033 
2034         PyObject *x = PyLong_Type.tp_as_number->nb_true_divide(operand1, operand2);
2035         assert(x != Py_NotImplemented);
2036 
2037         obj_result = x;
2038         goto exit_result_object;
2039 
2040     exit_result_object:
2041         if (unlikely(obj_result == NULL)) {
2042             goto exit_result_exception;
2043         }
2044         result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2045         Py_DECREF(obj_result);
2046         goto exit_result_ok;
2047 
2048     exit_result_ok:
2049         return result;
2050 
2051     exit_result_exception:
2052         return NUITKA_BOOL_EXCEPTION;
2053     }
2054 
2055     return __BINARY_OPERATION_TRUEDIV_NBOOL_LONG_OBJECT(operand1, operand2);
2056 }
2057 
BINARY_OPERATION_TRUEDIV_NBOOL_LONG_OBJECT(PyObject * operand1,PyObject * operand2)2058 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
2059     return _BINARY_OPERATION_TRUEDIV_NBOOL_LONG_OBJECT(operand1, operand2);
2060 }
2061 
2062 /* Code referring to "FLOAT" corresponds to Python 'float' and "FLOAT" to Python 'float'. */
_BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_FLOAT(PyObject * operand1,PyObject * operand2)2063 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
2064     CHECK_OBJECT(operand1);
2065     assert(PyFloat_CheckExact(operand1));
2066 #if PYTHON_VERSION < 0x300
2067     assert(NEW_STYLE_NUMBER(operand1));
2068 #endif
2069     CHECK_OBJECT(operand2);
2070     assert(PyFloat_CheckExact(operand2));
2071 #if PYTHON_VERSION < 0x300
2072     assert(NEW_STYLE_NUMBER(operand2));
2073 #endif
2074 
2075     PyObject *result;
2076 
2077 #ifdef _MSC_VER
2078 #pragma warning(push)
2079 #pragma warning(disable : 4101)
2080 #endif
2081     // Not every code path will make use of all possible results.
2082     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2083     NUITKA_MAY_BE_UNUSED long clong_result;
2084     NUITKA_MAY_BE_UNUSED double cfloat_result;
2085 #ifdef _MSC_VER
2086 #pragma warning(pop)
2087 #endif
2088 
2089     CHECK_OBJECT(operand1);
2090     assert(PyFloat_CheckExact(operand1));
2091 #if PYTHON_VERSION < 0x300
2092     assert(NEW_STYLE_NUMBER(operand1));
2093 #endif
2094     CHECK_OBJECT(operand2);
2095     assert(PyFloat_CheckExact(operand2));
2096 #if PYTHON_VERSION < 0x300
2097     assert(NEW_STYLE_NUMBER(operand2));
2098 #endif
2099 
2100     double a = PyFloat_AS_DOUBLE(operand1);
2101     double b = PyFloat_AS_DOUBLE(operand2);
2102 
2103     if (unlikely(b == 0.0)) {
2104         SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "float division by zero");
2105         goto exit_result_exception;
2106     }
2107 
2108     {
2109         double r = a / b;
2110 
2111         cfloat_result = r;
2112         goto exit_result_ok_cfloat;
2113     }
2114 
2115 exit_result_ok_cfloat:
2116     result = PyFloat_FromDouble(cfloat_result);
2117     goto exit_result_ok;
2118 
2119 exit_result_ok:
2120     return result;
2121 
2122 exit_result_exception:
2123     return NULL;
2124 }
2125 
BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_FLOAT(PyObject * operand1,PyObject * operand2)2126 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
2127     return _BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_FLOAT(operand1, operand2);
2128 }
2129 
2130 /* Code referring to "OBJECT" corresponds to any Python object and "FLOAT" to Python 'float'. */
__BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_FLOAT(PyObject * operand1,PyObject * operand2)2131 static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_FLOAT(PyObject *operand1,
2132                                                                                     PyObject *operand2) {
2133     PyTypeObject *type1 = Py_TYPE(operand1);
2134     PyTypeObject *type2 = &PyFloat_Type;
2135 
2136 #ifdef _MSC_VER
2137 #pragma warning(push)
2138 #pragma warning(disable : 4101)
2139 #endif
2140     NUITKA_MAY_BE_UNUSED bool cbool_result;
2141     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2142 #ifdef _MSC_VER
2143 #pragma warning(pop)
2144 #endif
2145 
2146     binaryfunc slot1 =
2147         (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
2148     binaryfunc slot2 = NULL;
2149 
2150     if (!(type1 == type2)) {
2151         assert(type1 != type2);
2152         /* Different types, need to consider second value slot. */
2153 
2154         slot2 = PyFloat_Type.tp_as_number->nb_true_divide;
2155 
2156         if (slot1 == slot2) {
2157             slot2 = NULL;
2158         }
2159     }
2160 
2161     if (slot1 != NULL) {
2162         PyObject *x = slot1(operand1, operand2);
2163 
2164         if (x != Py_NotImplemented) {
2165             obj_result = x;
2166             goto exit_binary_result_object;
2167         }
2168 
2169         Py_DECREF(x);
2170     }
2171 
2172     if (slot2 != NULL) {
2173         PyObject *x = slot2(operand1, operand2);
2174 
2175         if (x != Py_NotImplemented) {
2176             obj_result = x;
2177             goto exit_binary_result_object;
2178         }
2179 
2180         Py_DECREF(x);
2181     }
2182 
2183 #if PYTHON_VERSION < 0x300
2184     if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
2185         coercion c1 =
2186             (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
2187 
2188         if (c1 != NULL) {
2189             PyObject *coerced1 = operand1;
2190             PyObject *coerced2 = operand2;
2191 
2192             int err = c1(&coerced1, &coerced2);
2193 
2194             if (unlikely(err < 0)) {
2195                 goto exit_binary_exception;
2196             }
2197 
2198             if (err == 0) {
2199                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2200 
2201                 if (likely(mv == NULL)) {
2202                     binaryfunc slot = mv->nb_true_divide;
2203 
2204                     if (likely(slot != NULL)) {
2205                         PyObject *x = slot(coerced1, coerced2);
2206 
2207                         Py_DECREF(coerced1);
2208                         Py_DECREF(coerced2);
2209 
2210                         obj_result = x;
2211                         goto exit_binary_result_object;
2212                     }
2213                 }
2214 
2215                 // nb_coerce took a reference.
2216                 Py_DECREF(coerced1);
2217                 Py_DECREF(coerced2);
2218             }
2219         }
2220         coercion c2 = PyFloat_Type.tp_as_number->nb_coerce;
2221 
2222         if (c2 != NULL) {
2223             PyObject *coerced1 = operand1;
2224             PyObject *coerced2 = operand2;
2225 
2226             int err = c2(&coerced2, &coerced1);
2227 
2228             if (unlikely(err < 0)) {
2229                 goto exit_binary_exception;
2230             }
2231 
2232             if (err == 0) {
2233                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2234 
2235                 if (likely(mv == NULL)) {
2236                     binaryfunc slot = mv->nb_true_divide;
2237 
2238                     if (likely(slot != NULL)) {
2239                         PyObject *x = slot(coerced1, coerced2);
2240 
2241                         Py_DECREF(coerced1);
2242                         Py_DECREF(coerced2);
2243 
2244                         obj_result = x;
2245                         goto exit_binary_result_object;
2246                     }
2247                 }
2248 
2249                 // nb_coerce took a reference.
2250                 Py_DECREF(coerced1);
2251                 Py_DECREF(coerced2);
2252             }
2253         }
2254     }
2255 #endif
2256 
2257     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and 'float'", type1->tp_name);
2258     goto exit_binary_exception;
2259 
2260 exit_binary_result_object:
2261     return obj_result;
2262 
2263 exit_binary_exception:
2264     return NULL;
2265 }
_BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_FLOAT(PyObject * operand1,PyObject * operand2)2266 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
2267     CHECK_OBJECT(operand1);
2268     CHECK_OBJECT(operand2);
2269     assert(PyFloat_CheckExact(operand2));
2270 #if PYTHON_VERSION < 0x300
2271     assert(NEW_STYLE_NUMBER(operand2));
2272 #endif
2273 
2274     PyTypeObject *type1 = Py_TYPE(operand1);
2275     PyTypeObject *type2 = &PyFloat_Type;
2276 
2277     if (type1 == type2) {
2278         assert(type1 == type2);
2279 
2280         PyObject *result;
2281 
2282         // return _BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_FLOAT(operand1, operand2);
2283 
2284 #ifdef _MSC_VER
2285 #pragma warning(push)
2286 #pragma warning(disable : 4101)
2287 #endif
2288         // Not every code path will make use of all possible results.
2289         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2290         NUITKA_MAY_BE_UNUSED long clong_result;
2291         NUITKA_MAY_BE_UNUSED double cfloat_result;
2292 #ifdef _MSC_VER
2293 #pragma warning(pop)
2294 #endif
2295 
2296         CHECK_OBJECT(operand1);
2297         assert(PyFloat_CheckExact(operand1));
2298 #if PYTHON_VERSION < 0x300
2299         assert(NEW_STYLE_NUMBER(operand1));
2300 #endif
2301         CHECK_OBJECT(operand2);
2302         assert(PyFloat_CheckExact(operand2));
2303 #if PYTHON_VERSION < 0x300
2304         assert(NEW_STYLE_NUMBER(operand2));
2305 #endif
2306 
2307         double a = PyFloat_AS_DOUBLE(operand1);
2308         double b = PyFloat_AS_DOUBLE(operand2);
2309 
2310         if (unlikely(b == 0.0)) {
2311             SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "float division by zero");
2312             goto exit_result_exception;
2313         }
2314 
2315         {
2316             double r = a / b;
2317 
2318             cfloat_result = r;
2319             goto exit_result_ok_cfloat;
2320         }
2321 
2322     exit_result_ok_cfloat:
2323         result = PyFloat_FromDouble(cfloat_result);
2324         goto exit_result_ok;
2325 
2326     exit_result_ok:
2327         return result;
2328 
2329     exit_result_exception:
2330         return NULL;
2331     }
2332 
2333     return __BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_FLOAT(operand1, operand2);
2334 }
2335 
BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_FLOAT(PyObject * operand1,PyObject * operand2)2336 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
2337     return _BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_FLOAT(operand1, operand2);
2338 }
2339 
2340 /* Code referring to "FLOAT" corresponds to Python 'float' and "OBJECT" to any Python object. */
__BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_OBJECT(PyObject * operand1,PyObject * operand2)2341 static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_OBJECT(PyObject *operand1,
2342                                                                                     PyObject *operand2) {
2343     PyTypeObject *type1 = &PyFloat_Type;
2344     PyTypeObject *type2 = Py_TYPE(operand2);
2345 
2346 #ifdef _MSC_VER
2347 #pragma warning(push)
2348 #pragma warning(disable : 4101)
2349 #endif
2350     NUITKA_MAY_BE_UNUSED bool cbool_result;
2351     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2352 #ifdef _MSC_VER
2353 #pragma warning(pop)
2354 #endif
2355 
2356     binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_true_divide;
2357     binaryfunc slot2 = NULL;
2358 
2359     if (!(type1 == type2)) {
2360         assert(type1 != type2);
2361         /* Different types, need to consider second value slot. */
2362 
2363         slot2 =
2364             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide : NULL;
2365 
2366         if (slot1 == slot2) {
2367             slot2 = NULL;
2368         }
2369     }
2370 
2371     if (slot1 != NULL) {
2372         if (slot2 != NULL) {
2373             if (PyType_IsSubtype(type2, type1)) {
2374                 PyObject *x = slot2(operand1, operand2);
2375 
2376                 if (x != Py_NotImplemented) {
2377                     obj_result = x;
2378                     goto exit_binary_result_object;
2379                 }
2380 
2381                 Py_DECREF(x);
2382                 slot2 = NULL;
2383             }
2384         }
2385 
2386         PyObject *x = slot1(operand1, operand2);
2387 
2388         if (x != Py_NotImplemented) {
2389             obj_result = x;
2390             goto exit_binary_result_object;
2391         }
2392 
2393         Py_DECREF(x);
2394     }
2395 
2396     if (slot2 != NULL) {
2397         PyObject *x = slot2(operand1, operand2);
2398 
2399         if (x != Py_NotImplemented) {
2400             obj_result = x;
2401             goto exit_binary_result_object;
2402         }
2403 
2404         Py_DECREF(x);
2405     }
2406 
2407 #if PYTHON_VERSION < 0x300
2408     if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
2409         coercion c1 = PyFloat_Type.tp_as_number->nb_coerce;
2410 
2411         if (c1 != NULL) {
2412             PyObject *coerced1 = operand1;
2413             PyObject *coerced2 = operand2;
2414 
2415             int err = c1(&coerced1, &coerced2);
2416 
2417             if (unlikely(err < 0)) {
2418                 goto exit_binary_exception;
2419             }
2420 
2421             if (err == 0) {
2422                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2423 
2424                 if (likely(mv == NULL)) {
2425                     binaryfunc slot = mv->nb_true_divide;
2426 
2427                     if (likely(slot != NULL)) {
2428                         PyObject *x = slot(coerced1, coerced2);
2429 
2430                         Py_DECREF(coerced1);
2431                         Py_DECREF(coerced2);
2432 
2433                         obj_result = x;
2434                         goto exit_binary_result_object;
2435                     }
2436                 }
2437 
2438                 // nb_coerce took a reference.
2439                 Py_DECREF(coerced1);
2440                 Py_DECREF(coerced2);
2441             }
2442         }
2443         coercion c2 =
2444             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2445 
2446         if (c2 != NULL) {
2447             PyObject *coerced1 = operand1;
2448             PyObject *coerced2 = operand2;
2449 
2450             int err = c2(&coerced2, &coerced1);
2451 
2452             if (unlikely(err < 0)) {
2453                 goto exit_binary_exception;
2454             }
2455 
2456             if (err == 0) {
2457                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2458 
2459                 if (likely(mv == NULL)) {
2460                     binaryfunc slot = mv->nb_true_divide;
2461 
2462                     if (likely(slot != NULL)) {
2463                         PyObject *x = slot(coerced1, coerced2);
2464 
2465                         Py_DECREF(coerced1);
2466                         Py_DECREF(coerced2);
2467 
2468                         obj_result = x;
2469                         goto exit_binary_result_object;
2470                     }
2471                 }
2472 
2473                 // nb_coerce took a reference.
2474                 Py_DECREF(coerced1);
2475                 Py_DECREF(coerced2);
2476             }
2477         }
2478     }
2479 #endif
2480 
2481     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'float' and '%s'", type2->tp_name);
2482     goto exit_binary_exception;
2483 
2484 exit_binary_result_object:
2485     return obj_result;
2486 
2487 exit_binary_exception:
2488     return NULL;
2489 }
_BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_OBJECT(PyObject * operand1,PyObject * operand2)2490 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
2491     CHECK_OBJECT(operand1);
2492     assert(PyFloat_CheckExact(operand1));
2493 #if PYTHON_VERSION < 0x300
2494     assert(NEW_STYLE_NUMBER(operand1));
2495 #endif
2496     CHECK_OBJECT(operand2);
2497 
2498     PyTypeObject *type1 = &PyFloat_Type;
2499     PyTypeObject *type2 = Py_TYPE(operand2);
2500 
2501     if (type1 == type2) {
2502         assert(type1 == type2);
2503 
2504         PyObject *result;
2505 
2506         // return _BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_FLOAT(operand1, operand2);
2507 
2508 #ifdef _MSC_VER
2509 #pragma warning(push)
2510 #pragma warning(disable : 4101)
2511 #endif
2512         // Not every code path will make use of all possible results.
2513         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2514         NUITKA_MAY_BE_UNUSED long clong_result;
2515         NUITKA_MAY_BE_UNUSED double cfloat_result;
2516 #ifdef _MSC_VER
2517 #pragma warning(pop)
2518 #endif
2519 
2520         CHECK_OBJECT(operand1);
2521         assert(PyFloat_CheckExact(operand1));
2522 #if PYTHON_VERSION < 0x300
2523         assert(NEW_STYLE_NUMBER(operand1));
2524 #endif
2525         CHECK_OBJECT(operand2);
2526         assert(PyFloat_CheckExact(operand2));
2527 #if PYTHON_VERSION < 0x300
2528         assert(NEW_STYLE_NUMBER(operand2));
2529 #endif
2530 
2531         double a = PyFloat_AS_DOUBLE(operand1);
2532         double b = PyFloat_AS_DOUBLE(operand2);
2533 
2534         if (unlikely(b == 0.0)) {
2535             SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "float division by zero");
2536             goto exit_result_exception;
2537         }
2538 
2539         {
2540             double r = a / b;
2541 
2542             cfloat_result = r;
2543             goto exit_result_ok_cfloat;
2544         }
2545 
2546     exit_result_ok_cfloat:
2547         result = PyFloat_FromDouble(cfloat_result);
2548         goto exit_result_ok;
2549 
2550     exit_result_ok:
2551         return result;
2552 
2553     exit_result_exception:
2554         return NULL;
2555     }
2556 
2557     return __BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_OBJECT(operand1, operand2);
2558 }
2559 
BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_OBJECT(PyObject * operand1,PyObject * operand2)2560 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
2561     return _BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_OBJECT(operand1, operand2);
2562 }
2563 
2564 /* Code referring to "FLOAT" corresponds to Python 'float' and "FLOAT" to Python 'float'. */
_BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_FLOAT(PyObject * operand1,PyObject * operand2)2565 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
2566     CHECK_OBJECT(operand1);
2567     assert(PyFloat_CheckExact(operand1));
2568 #if PYTHON_VERSION < 0x300
2569     assert(NEW_STYLE_NUMBER(operand1));
2570 #endif
2571     CHECK_OBJECT(operand2);
2572     assert(PyFloat_CheckExact(operand2));
2573 #if PYTHON_VERSION < 0x300
2574     assert(NEW_STYLE_NUMBER(operand2));
2575 #endif
2576 
2577     nuitka_bool result;
2578 
2579 #ifdef _MSC_VER
2580 #pragma warning(push)
2581 #pragma warning(disable : 4101)
2582 #endif
2583     // Not every code path will make use of all possible results.
2584     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2585     NUITKA_MAY_BE_UNUSED long clong_result;
2586     NUITKA_MAY_BE_UNUSED double cfloat_result;
2587 #ifdef _MSC_VER
2588 #pragma warning(pop)
2589 #endif
2590 
2591     CHECK_OBJECT(operand1);
2592     assert(PyFloat_CheckExact(operand1));
2593 #if PYTHON_VERSION < 0x300
2594     assert(NEW_STYLE_NUMBER(operand1));
2595 #endif
2596     CHECK_OBJECT(operand2);
2597     assert(PyFloat_CheckExact(operand2));
2598 #if PYTHON_VERSION < 0x300
2599     assert(NEW_STYLE_NUMBER(operand2));
2600 #endif
2601 
2602     double a = PyFloat_AS_DOUBLE(operand1);
2603     double b = PyFloat_AS_DOUBLE(operand2);
2604 
2605     if (unlikely(b == 0.0)) {
2606         SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "float division by zero");
2607         goto exit_result_exception;
2608     }
2609 
2610     {
2611         double r = a / b;
2612 
2613         cfloat_result = r;
2614         goto exit_result_ok_cfloat;
2615     }
2616 
2617 exit_result_ok_cfloat:
2618     result = cfloat_result != 0.0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2619     goto exit_result_ok;
2620 
2621 exit_result_ok:
2622     return result;
2623 
2624 exit_result_exception:
2625     return NUITKA_BOOL_EXCEPTION;
2626 }
2627 
BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_FLOAT(PyObject * operand1,PyObject * operand2)2628 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
2629     return _BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_FLOAT(operand1, operand2);
2630 }
2631 
2632 /* Code referring to "OBJECT" corresponds to any Python object and "FLOAT" to Python 'float'. */
__BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_FLOAT(PyObject * operand1,PyObject * operand2)2633 static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_FLOAT(PyObject *operand1,
2634                                                                                      PyObject *operand2) {
2635     PyTypeObject *type1 = Py_TYPE(operand1);
2636     PyTypeObject *type2 = &PyFloat_Type;
2637 
2638 #ifdef _MSC_VER
2639 #pragma warning(push)
2640 #pragma warning(disable : 4101)
2641 #endif
2642     NUITKA_MAY_BE_UNUSED bool cbool_result;
2643     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2644 #ifdef _MSC_VER
2645 #pragma warning(pop)
2646 #endif
2647 
2648     binaryfunc slot1 =
2649         (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
2650     binaryfunc slot2 = NULL;
2651 
2652     if (!(type1 == type2)) {
2653         assert(type1 != type2);
2654         /* Different types, need to consider second value slot. */
2655 
2656         slot2 = PyFloat_Type.tp_as_number->nb_true_divide;
2657 
2658         if (slot1 == slot2) {
2659             slot2 = NULL;
2660         }
2661     }
2662 
2663     if (slot1 != NULL) {
2664         PyObject *x = slot1(operand1, operand2);
2665 
2666         if (x != Py_NotImplemented) {
2667             obj_result = x;
2668             goto exit_binary_result_object;
2669         }
2670 
2671         Py_DECREF(x);
2672     }
2673 
2674     if (slot2 != NULL) {
2675         PyObject *x = slot2(operand1, operand2);
2676 
2677         if (x != Py_NotImplemented) {
2678             obj_result = x;
2679             goto exit_binary_result_object;
2680         }
2681 
2682         Py_DECREF(x);
2683     }
2684 
2685 #if PYTHON_VERSION < 0x300
2686     if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
2687         coercion c1 =
2688             (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
2689 
2690         if (c1 != NULL) {
2691             PyObject *coerced1 = operand1;
2692             PyObject *coerced2 = operand2;
2693 
2694             int err = c1(&coerced1, &coerced2);
2695 
2696             if (unlikely(err < 0)) {
2697                 goto exit_binary_exception;
2698             }
2699 
2700             if (err == 0) {
2701                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2702 
2703                 if (likely(mv == NULL)) {
2704                     binaryfunc slot = mv->nb_true_divide;
2705 
2706                     if (likely(slot != NULL)) {
2707                         PyObject *x = slot(coerced1, coerced2);
2708 
2709                         Py_DECREF(coerced1);
2710                         Py_DECREF(coerced2);
2711 
2712                         obj_result = x;
2713                         goto exit_binary_result_object;
2714                     }
2715                 }
2716 
2717                 // nb_coerce took a reference.
2718                 Py_DECREF(coerced1);
2719                 Py_DECREF(coerced2);
2720             }
2721         }
2722         coercion c2 = PyFloat_Type.tp_as_number->nb_coerce;
2723 
2724         if (c2 != NULL) {
2725             PyObject *coerced1 = operand1;
2726             PyObject *coerced2 = operand2;
2727 
2728             int err = c2(&coerced2, &coerced1);
2729 
2730             if (unlikely(err < 0)) {
2731                 goto exit_binary_exception;
2732             }
2733 
2734             if (err == 0) {
2735                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2736 
2737                 if (likely(mv == NULL)) {
2738                     binaryfunc slot = mv->nb_true_divide;
2739 
2740                     if (likely(slot != NULL)) {
2741                         PyObject *x = slot(coerced1, coerced2);
2742 
2743                         Py_DECREF(coerced1);
2744                         Py_DECREF(coerced2);
2745 
2746                         obj_result = x;
2747                         goto exit_binary_result_object;
2748                     }
2749                 }
2750 
2751                 // nb_coerce took a reference.
2752                 Py_DECREF(coerced1);
2753                 Py_DECREF(coerced2);
2754             }
2755         }
2756     }
2757 #endif
2758 
2759     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and 'float'", type1->tp_name);
2760     goto exit_binary_exception;
2761 
2762 exit_binary_result_object:
2763     if (unlikely(obj_result == NULL)) {
2764         return NUITKA_BOOL_EXCEPTION;
2765     }
2766 
2767     {
2768         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2769         Py_DECREF(obj_result);
2770         return r;
2771     }
2772 
2773 exit_binary_exception:
2774     return NUITKA_BOOL_EXCEPTION;
2775 }
_BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_FLOAT(PyObject * operand1,PyObject * operand2)2776 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
2777     CHECK_OBJECT(operand1);
2778     CHECK_OBJECT(operand2);
2779     assert(PyFloat_CheckExact(operand2));
2780 #if PYTHON_VERSION < 0x300
2781     assert(NEW_STYLE_NUMBER(operand2));
2782 #endif
2783 
2784     PyTypeObject *type1 = Py_TYPE(operand1);
2785     PyTypeObject *type2 = &PyFloat_Type;
2786 
2787     if (type1 == type2) {
2788         assert(type1 == type2);
2789 
2790         nuitka_bool result;
2791 
2792         // return _BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_FLOAT(operand1, operand2);
2793 
2794 #ifdef _MSC_VER
2795 #pragma warning(push)
2796 #pragma warning(disable : 4101)
2797 #endif
2798         // Not every code path will make use of all possible results.
2799         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2800         NUITKA_MAY_BE_UNUSED long clong_result;
2801         NUITKA_MAY_BE_UNUSED double cfloat_result;
2802 #ifdef _MSC_VER
2803 #pragma warning(pop)
2804 #endif
2805 
2806         CHECK_OBJECT(operand1);
2807         assert(PyFloat_CheckExact(operand1));
2808 #if PYTHON_VERSION < 0x300
2809         assert(NEW_STYLE_NUMBER(operand1));
2810 #endif
2811         CHECK_OBJECT(operand2);
2812         assert(PyFloat_CheckExact(operand2));
2813 #if PYTHON_VERSION < 0x300
2814         assert(NEW_STYLE_NUMBER(operand2));
2815 #endif
2816 
2817         double a = PyFloat_AS_DOUBLE(operand1);
2818         double b = PyFloat_AS_DOUBLE(operand2);
2819 
2820         if (unlikely(b == 0.0)) {
2821             SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "float division by zero");
2822             goto exit_result_exception;
2823         }
2824 
2825         {
2826             double r = a / b;
2827 
2828             cfloat_result = r;
2829             goto exit_result_ok_cfloat;
2830         }
2831 
2832     exit_result_ok_cfloat:
2833         result = cfloat_result != 0.0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2834         goto exit_result_ok;
2835 
2836     exit_result_ok:
2837         return result;
2838 
2839     exit_result_exception:
2840         return NUITKA_BOOL_EXCEPTION;
2841     }
2842 
2843     return __BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_FLOAT(operand1, operand2);
2844 }
2845 
BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_FLOAT(PyObject * operand1,PyObject * operand2)2846 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
2847     return _BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_FLOAT(operand1, operand2);
2848 }
2849 
2850 /* Code referring to "FLOAT" corresponds to Python 'float' and "OBJECT" to any Python object. */
__BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_OBJECT(PyObject * operand1,PyObject * operand2)2851 static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_OBJECT(PyObject *operand1,
2852                                                                                      PyObject *operand2) {
2853     PyTypeObject *type1 = &PyFloat_Type;
2854     PyTypeObject *type2 = Py_TYPE(operand2);
2855 
2856 #ifdef _MSC_VER
2857 #pragma warning(push)
2858 #pragma warning(disable : 4101)
2859 #endif
2860     NUITKA_MAY_BE_UNUSED bool cbool_result;
2861     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2862 #ifdef _MSC_VER
2863 #pragma warning(pop)
2864 #endif
2865 
2866     binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_true_divide;
2867     binaryfunc slot2 = NULL;
2868 
2869     if (!(type1 == type2)) {
2870         assert(type1 != type2);
2871         /* Different types, need to consider second value slot. */
2872 
2873         slot2 =
2874             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide : NULL;
2875 
2876         if (slot1 == slot2) {
2877             slot2 = NULL;
2878         }
2879     }
2880 
2881     if (slot1 != NULL) {
2882         if (slot2 != NULL) {
2883             if (PyType_IsSubtype(type2, type1)) {
2884                 PyObject *x = slot2(operand1, operand2);
2885 
2886                 if (x != Py_NotImplemented) {
2887                     obj_result = x;
2888                     goto exit_binary_result_object;
2889                 }
2890 
2891                 Py_DECREF(x);
2892                 slot2 = NULL;
2893             }
2894         }
2895 
2896         PyObject *x = slot1(operand1, operand2);
2897 
2898         if (x != Py_NotImplemented) {
2899             obj_result = x;
2900             goto exit_binary_result_object;
2901         }
2902 
2903         Py_DECREF(x);
2904     }
2905 
2906     if (slot2 != NULL) {
2907         PyObject *x = slot2(operand1, operand2);
2908 
2909         if (x != Py_NotImplemented) {
2910             obj_result = x;
2911             goto exit_binary_result_object;
2912         }
2913 
2914         Py_DECREF(x);
2915     }
2916 
2917 #if PYTHON_VERSION < 0x300
2918     if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
2919         coercion c1 = PyFloat_Type.tp_as_number->nb_coerce;
2920 
2921         if (c1 != NULL) {
2922             PyObject *coerced1 = operand1;
2923             PyObject *coerced2 = operand2;
2924 
2925             int err = c1(&coerced1, &coerced2);
2926 
2927             if (unlikely(err < 0)) {
2928                 goto exit_binary_exception;
2929             }
2930 
2931             if (err == 0) {
2932                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2933 
2934                 if (likely(mv == NULL)) {
2935                     binaryfunc slot = mv->nb_true_divide;
2936 
2937                     if (likely(slot != NULL)) {
2938                         PyObject *x = slot(coerced1, coerced2);
2939 
2940                         Py_DECREF(coerced1);
2941                         Py_DECREF(coerced2);
2942 
2943                         obj_result = x;
2944                         goto exit_binary_result_object;
2945                     }
2946                 }
2947 
2948                 // nb_coerce took a reference.
2949                 Py_DECREF(coerced1);
2950                 Py_DECREF(coerced2);
2951             }
2952         }
2953         coercion c2 =
2954             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2955 
2956         if (c2 != NULL) {
2957             PyObject *coerced1 = operand1;
2958             PyObject *coerced2 = operand2;
2959 
2960             int err = c2(&coerced2, &coerced1);
2961 
2962             if (unlikely(err < 0)) {
2963                 goto exit_binary_exception;
2964             }
2965 
2966             if (err == 0) {
2967                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2968 
2969                 if (likely(mv == NULL)) {
2970                     binaryfunc slot = mv->nb_true_divide;
2971 
2972                     if (likely(slot != NULL)) {
2973                         PyObject *x = slot(coerced1, coerced2);
2974 
2975                         Py_DECREF(coerced1);
2976                         Py_DECREF(coerced2);
2977 
2978                         obj_result = x;
2979                         goto exit_binary_result_object;
2980                     }
2981                 }
2982 
2983                 // nb_coerce took a reference.
2984                 Py_DECREF(coerced1);
2985                 Py_DECREF(coerced2);
2986             }
2987         }
2988     }
2989 #endif
2990 
2991     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'float' and '%s'", type2->tp_name);
2992     goto exit_binary_exception;
2993 
2994 exit_binary_result_object:
2995     if (unlikely(obj_result == NULL)) {
2996         return NUITKA_BOOL_EXCEPTION;
2997     }
2998 
2999     {
3000         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3001         Py_DECREF(obj_result);
3002         return r;
3003     }
3004 
3005 exit_binary_exception:
3006     return NUITKA_BOOL_EXCEPTION;
3007 }
_BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_OBJECT(PyObject * operand1,PyObject * operand2)3008 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
3009     CHECK_OBJECT(operand1);
3010     assert(PyFloat_CheckExact(operand1));
3011 #if PYTHON_VERSION < 0x300
3012     assert(NEW_STYLE_NUMBER(operand1));
3013 #endif
3014     CHECK_OBJECT(operand2);
3015 
3016     PyTypeObject *type1 = &PyFloat_Type;
3017     PyTypeObject *type2 = Py_TYPE(operand2);
3018 
3019     if (type1 == type2) {
3020         assert(type1 == type2);
3021 
3022         nuitka_bool result;
3023 
3024         // return _BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_FLOAT(operand1, operand2);
3025 
3026 #ifdef _MSC_VER
3027 #pragma warning(push)
3028 #pragma warning(disable : 4101)
3029 #endif
3030         // Not every code path will make use of all possible results.
3031         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3032         NUITKA_MAY_BE_UNUSED long clong_result;
3033         NUITKA_MAY_BE_UNUSED double cfloat_result;
3034 #ifdef _MSC_VER
3035 #pragma warning(pop)
3036 #endif
3037 
3038         CHECK_OBJECT(operand1);
3039         assert(PyFloat_CheckExact(operand1));
3040 #if PYTHON_VERSION < 0x300
3041         assert(NEW_STYLE_NUMBER(operand1));
3042 #endif
3043         CHECK_OBJECT(operand2);
3044         assert(PyFloat_CheckExact(operand2));
3045 #if PYTHON_VERSION < 0x300
3046         assert(NEW_STYLE_NUMBER(operand2));
3047 #endif
3048 
3049         double a = PyFloat_AS_DOUBLE(operand1);
3050         double b = PyFloat_AS_DOUBLE(operand2);
3051 
3052         if (unlikely(b == 0.0)) {
3053             SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "float division by zero");
3054             goto exit_result_exception;
3055         }
3056 
3057         {
3058             double r = a / b;
3059 
3060             cfloat_result = r;
3061             goto exit_result_ok_cfloat;
3062         }
3063 
3064     exit_result_ok_cfloat:
3065         result = cfloat_result != 0.0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3066         goto exit_result_ok;
3067 
3068     exit_result_ok:
3069         return result;
3070 
3071     exit_result_exception:
3072         return NUITKA_BOOL_EXCEPTION;
3073     }
3074 
3075     return __BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_OBJECT(operand1, operand2);
3076 }
3077 
BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_OBJECT(PyObject * operand1,PyObject * operand2)3078 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
3079     return _BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_OBJECT(operand1, operand2);
3080 }
3081 
3082 #if PYTHON_VERSION < 0x300
3083 /* Code referring to "INT" corresponds to Python2 'int' and "LONG" to Python2 'long', Python3 'int'. */
_BINARY_OPERATION_TRUEDIV_OBJECT_INT_LONG(PyObject * operand1,PyObject * operand2)3084 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_INT_LONG(PyObject *operand1, PyObject *operand2) {
3085     CHECK_OBJECT(operand1);
3086     assert(PyInt_CheckExact(operand1));
3087 #if PYTHON_VERSION < 0x300
3088     assert(NEW_STYLE_NUMBER(operand1));
3089 #endif
3090     CHECK_OBJECT(operand2);
3091     assert(PyLong_CheckExact(operand2));
3092 #if PYTHON_VERSION < 0x300
3093     assert(NEW_STYLE_NUMBER(operand2));
3094 #endif
3095 
3096     PyTypeObject *type1 = &PyInt_Type;
3097     PyTypeObject *type2 = &PyLong_Type;
3098 
3099 #ifdef _MSC_VER
3100 #pragma warning(push)
3101 #pragma warning(disable : 4101)
3102 #endif
3103     NUITKA_MAY_BE_UNUSED bool cbool_result;
3104     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3105 #ifdef _MSC_VER
3106 #pragma warning(pop)
3107 #endif
3108 
3109     binaryfunc slot1 = PyInt_Type.tp_as_number->nb_true_divide;
3110     binaryfunc slot2 = NULL;
3111 
3112     if (!(0)) {
3113         assert(type1 != type2);
3114         /* Different types, need to consider second value slot. */
3115 
3116         slot2 = PyLong_Type.tp_as_number->nb_true_divide;
3117     }
3118 
3119     if (slot1 != NULL) {
3120         PyObject *x = slot1(operand1, operand2);
3121 
3122         if (x != Py_NotImplemented) {
3123             obj_result = x;
3124             goto exit_binary_result_object;
3125         }
3126 
3127         Py_DECREF(x);
3128     }
3129 
3130     if (slot2 != NULL) {
3131         PyObject *x = slot2(operand1, operand2);
3132 
3133         if (x != Py_NotImplemented) {
3134             obj_result = x;
3135             goto exit_binary_result_object;
3136         }
3137 
3138         Py_DECREF(x);
3139     }
3140 
3141     // Statically recognized that coercion is not possible with these types
3142 
3143     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'int' and 'long'");
3144     goto exit_binary_exception;
3145 
3146 exit_binary_result_object:
3147     return obj_result;
3148 
3149 exit_binary_exception:
3150     return NULL;
3151 }
3152 
BINARY_OPERATION_TRUEDIV_OBJECT_INT_LONG(PyObject * operand1,PyObject * operand2)3153 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_INT_LONG(PyObject *operand1, PyObject *operand2) {
3154     return _BINARY_OPERATION_TRUEDIV_OBJECT_INT_LONG(operand1, operand2);
3155 }
3156 #endif
3157 
3158 #if PYTHON_VERSION < 0x300
3159 /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
_BINARY_OPERATION_TRUEDIV_OBJECT_LONG_INT(PyObject * operand1,PyObject * operand2)3160 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
3161     CHECK_OBJECT(operand1);
3162     assert(PyLong_CheckExact(operand1));
3163 #if PYTHON_VERSION < 0x300
3164     assert(NEW_STYLE_NUMBER(operand1));
3165 #endif
3166     CHECK_OBJECT(operand2);
3167     assert(PyInt_CheckExact(operand2));
3168 #if PYTHON_VERSION < 0x300
3169     assert(NEW_STYLE_NUMBER(operand2));
3170 #endif
3171 
3172     PyTypeObject *type1 = &PyLong_Type;
3173     PyTypeObject *type2 = &PyInt_Type;
3174 
3175 #ifdef _MSC_VER
3176 #pragma warning(push)
3177 #pragma warning(disable : 4101)
3178 #endif
3179     NUITKA_MAY_BE_UNUSED bool cbool_result;
3180     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3181 #ifdef _MSC_VER
3182 #pragma warning(pop)
3183 #endif
3184 
3185     binaryfunc slot1 = PyLong_Type.tp_as_number->nb_true_divide;
3186     binaryfunc slot2 = NULL;
3187 
3188     if (!(0)) {
3189         assert(type1 != type2);
3190         /* Different types, need to consider second value slot. */
3191 
3192         slot2 = PyInt_Type.tp_as_number->nb_true_divide;
3193     }
3194 
3195     if (slot1 != NULL) {
3196         PyObject *x = slot1(operand1, operand2);
3197 
3198         if (x != Py_NotImplemented) {
3199             obj_result = x;
3200             goto exit_binary_result_object;
3201         }
3202 
3203         Py_DECREF(x);
3204     }
3205 
3206     if (slot2 != NULL) {
3207         PyObject *x = slot2(operand1, operand2);
3208 
3209         if (x != Py_NotImplemented) {
3210             obj_result = x;
3211             goto exit_binary_result_object;
3212         }
3213 
3214         Py_DECREF(x);
3215     }
3216 
3217     // Statically recognized that coercion is not possible with these types
3218 
3219     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'long' and 'int'");
3220     goto exit_binary_exception;
3221 
3222 exit_binary_result_object:
3223     return obj_result;
3224 
3225 exit_binary_exception:
3226     return NULL;
3227 }
3228 
BINARY_OPERATION_TRUEDIV_OBJECT_LONG_INT(PyObject * operand1,PyObject * operand2)3229 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
3230     return _BINARY_OPERATION_TRUEDIV_OBJECT_LONG_INT(operand1, operand2);
3231 }
3232 #endif
3233 
3234 #if PYTHON_VERSION < 0x300
3235 /* Code referring to "INT" corresponds to Python2 'int' and "LONG" to Python2 'long', Python3 'int'. */
_BINARY_OPERATION_TRUEDIV_NBOOL_INT_LONG(PyObject * operand1,PyObject * operand2)3236 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_INT_LONG(PyObject *operand1, PyObject *operand2) {
3237     CHECK_OBJECT(operand1);
3238     assert(PyInt_CheckExact(operand1));
3239 #if PYTHON_VERSION < 0x300
3240     assert(NEW_STYLE_NUMBER(operand1));
3241 #endif
3242     CHECK_OBJECT(operand2);
3243     assert(PyLong_CheckExact(operand2));
3244 #if PYTHON_VERSION < 0x300
3245     assert(NEW_STYLE_NUMBER(operand2));
3246 #endif
3247 
3248     PyTypeObject *type1 = &PyInt_Type;
3249     PyTypeObject *type2 = &PyLong_Type;
3250 
3251 #ifdef _MSC_VER
3252 #pragma warning(push)
3253 #pragma warning(disable : 4101)
3254 #endif
3255     NUITKA_MAY_BE_UNUSED bool cbool_result;
3256     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3257 #ifdef _MSC_VER
3258 #pragma warning(pop)
3259 #endif
3260 
3261     binaryfunc slot1 = PyInt_Type.tp_as_number->nb_true_divide;
3262     binaryfunc slot2 = NULL;
3263 
3264     if (!(0)) {
3265         assert(type1 != type2);
3266         /* Different types, need to consider second value slot. */
3267 
3268         slot2 = PyLong_Type.tp_as_number->nb_true_divide;
3269     }
3270 
3271     if (slot1 != NULL) {
3272         PyObject *x = slot1(operand1, operand2);
3273 
3274         if (x != Py_NotImplemented) {
3275             obj_result = x;
3276             goto exit_binary_result_object;
3277         }
3278 
3279         Py_DECREF(x);
3280     }
3281 
3282     if (slot2 != NULL) {
3283         PyObject *x = slot2(operand1, operand2);
3284 
3285         if (x != Py_NotImplemented) {
3286             obj_result = x;
3287             goto exit_binary_result_object;
3288         }
3289 
3290         Py_DECREF(x);
3291     }
3292 
3293     // Statically recognized that coercion is not possible with these types
3294 
3295     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'int' and 'long'");
3296     goto exit_binary_exception;
3297 
3298 exit_binary_result_object:
3299     if (unlikely(obj_result == NULL)) {
3300         return NUITKA_BOOL_EXCEPTION;
3301     }
3302 
3303     {
3304         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3305         Py_DECREF(obj_result);
3306         return r;
3307     }
3308 
3309 exit_binary_exception:
3310     return NUITKA_BOOL_EXCEPTION;
3311 }
3312 
BINARY_OPERATION_TRUEDIV_NBOOL_INT_LONG(PyObject * operand1,PyObject * operand2)3313 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_INT_LONG(PyObject *operand1, PyObject *operand2) {
3314     return _BINARY_OPERATION_TRUEDIV_NBOOL_INT_LONG(operand1, operand2);
3315 }
3316 #endif
3317 
3318 #if PYTHON_VERSION < 0x300
3319 /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
_BINARY_OPERATION_TRUEDIV_NBOOL_LONG_INT(PyObject * operand1,PyObject * operand2)3320 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
3321     CHECK_OBJECT(operand1);
3322     assert(PyLong_CheckExact(operand1));
3323 #if PYTHON_VERSION < 0x300
3324     assert(NEW_STYLE_NUMBER(operand1));
3325 #endif
3326     CHECK_OBJECT(operand2);
3327     assert(PyInt_CheckExact(operand2));
3328 #if PYTHON_VERSION < 0x300
3329     assert(NEW_STYLE_NUMBER(operand2));
3330 #endif
3331 
3332     PyTypeObject *type1 = &PyLong_Type;
3333     PyTypeObject *type2 = &PyInt_Type;
3334 
3335 #ifdef _MSC_VER
3336 #pragma warning(push)
3337 #pragma warning(disable : 4101)
3338 #endif
3339     NUITKA_MAY_BE_UNUSED bool cbool_result;
3340     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3341 #ifdef _MSC_VER
3342 #pragma warning(pop)
3343 #endif
3344 
3345     binaryfunc slot1 = PyLong_Type.tp_as_number->nb_true_divide;
3346     binaryfunc slot2 = NULL;
3347 
3348     if (!(0)) {
3349         assert(type1 != type2);
3350         /* Different types, need to consider second value slot. */
3351 
3352         slot2 = PyInt_Type.tp_as_number->nb_true_divide;
3353     }
3354 
3355     if (slot1 != NULL) {
3356         PyObject *x = slot1(operand1, operand2);
3357 
3358         if (x != Py_NotImplemented) {
3359             obj_result = x;
3360             goto exit_binary_result_object;
3361         }
3362 
3363         Py_DECREF(x);
3364     }
3365 
3366     if (slot2 != NULL) {
3367         PyObject *x = slot2(operand1, operand2);
3368 
3369         if (x != Py_NotImplemented) {
3370             obj_result = x;
3371             goto exit_binary_result_object;
3372         }
3373 
3374         Py_DECREF(x);
3375     }
3376 
3377     // Statically recognized that coercion is not possible with these types
3378 
3379     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'long' and 'int'");
3380     goto exit_binary_exception;
3381 
3382 exit_binary_result_object:
3383     if (unlikely(obj_result == NULL)) {
3384         return NUITKA_BOOL_EXCEPTION;
3385     }
3386 
3387     {
3388         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3389         Py_DECREF(obj_result);
3390         return r;
3391     }
3392 
3393 exit_binary_exception:
3394     return NUITKA_BOOL_EXCEPTION;
3395 }
3396 
BINARY_OPERATION_TRUEDIV_NBOOL_LONG_INT(PyObject * operand1,PyObject * operand2)3397 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
3398     return _BINARY_OPERATION_TRUEDIV_NBOOL_LONG_INT(operand1, operand2);
3399 }
3400 #endif
3401 
3402 #if PYTHON_VERSION < 0x300
3403 /* Code referring to "INT" corresponds to Python2 'int' and "FLOAT" to Python 'float'. */
_BINARY_OPERATION_TRUEDIV_OBJECT_INT_FLOAT(PyObject * operand1,PyObject * operand2)3404 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_INT_FLOAT(PyObject *operand1, PyObject *operand2) {
3405     CHECK_OBJECT(operand1);
3406     assert(PyInt_CheckExact(operand1));
3407 #if PYTHON_VERSION < 0x300
3408     assert(NEW_STYLE_NUMBER(operand1));
3409 #endif
3410     CHECK_OBJECT(operand2);
3411     assert(PyFloat_CheckExact(operand2));
3412 #if PYTHON_VERSION < 0x300
3413     assert(NEW_STYLE_NUMBER(operand2));
3414 #endif
3415 
3416     PyTypeObject *type1 = &PyInt_Type;
3417     PyTypeObject *type2 = &PyFloat_Type;
3418 
3419 #ifdef _MSC_VER
3420 #pragma warning(push)
3421 #pragma warning(disable : 4101)
3422 #endif
3423     NUITKA_MAY_BE_UNUSED bool cbool_result;
3424     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3425 #ifdef _MSC_VER
3426 #pragma warning(pop)
3427 #endif
3428 
3429     binaryfunc slot1 = PyInt_Type.tp_as_number->nb_true_divide;
3430     binaryfunc slot2 = NULL;
3431 
3432     if (!(0)) {
3433         assert(type1 != type2);
3434         /* Different types, need to consider second value slot. */
3435 
3436         slot2 = PyFloat_Type.tp_as_number->nb_true_divide;
3437     }
3438 
3439     if (slot1 != NULL) {
3440         PyObject *x = slot1(operand1, operand2);
3441 
3442         if (x != Py_NotImplemented) {
3443             obj_result = x;
3444             goto exit_binary_result_object;
3445         }
3446 
3447         Py_DECREF(x);
3448     }
3449 
3450     if (slot2 != NULL) {
3451         PyObject *x = slot2(operand1, operand2);
3452 
3453         if (x != Py_NotImplemented) {
3454             obj_result = x;
3455             goto exit_binary_result_object;
3456         }
3457 
3458         Py_DECREF(x);
3459     }
3460 
3461     // Statically recognized that coercion is not possible with these types
3462 
3463     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'int' and 'float'");
3464     goto exit_binary_exception;
3465 
3466 exit_binary_result_object:
3467     return obj_result;
3468 
3469 exit_binary_exception:
3470     return NULL;
3471 }
3472 
BINARY_OPERATION_TRUEDIV_OBJECT_INT_FLOAT(PyObject * operand1,PyObject * operand2)3473 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_INT_FLOAT(PyObject *operand1, PyObject *operand2) {
3474     return _BINARY_OPERATION_TRUEDIV_OBJECT_INT_FLOAT(operand1, operand2);
3475 }
3476 #endif
3477 
3478 #if PYTHON_VERSION < 0x300
3479 /* Code referring to "FLOAT" corresponds to Python 'float' and "INT" to Python2 'int'. */
_BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_INT(PyObject * operand1,PyObject * operand2)3480 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_INT(PyObject *operand1, PyObject *operand2) {
3481     CHECK_OBJECT(operand1);
3482     assert(PyFloat_CheckExact(operand1));
3483 #if PYTHON_VERSION < 0x300
3484     assert(NEW_STYLE_NUMBER(operand1));
3485 #endif
3486     CHECK_OBJECT(operand2);
3487     assert(PyInt_CheckExact(operand2));
3488 #if PYTHON_VERSION < 0x300
3489     assert(NEW_STYLE_NUMBER(operand2));
3490 #endif
3491 
3492     PyTypeObject *type1 = &PyFloat_Type;
3493     PyTypeObject *type2 = &PyInt_Type;
3494 
3495 #ifdef _MSC_VER
3496 #pragma warning(push)
3497 #pragma warning(disable : 4101)
3498 #endif
3499     NUITKA_MAY_BE_UNUSED bool cbool_result;
3500     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3501 #ifdef _MSC_VER
3502 #pragma warning(pop)
3503 #endif
3504 
3505     binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_true_divide;
3506     binaryfunc slot2 = NULL;
3507 
3508     if (!(0)) {
3509         assert(type1 != type2);
3510         /* Different types, need to consider second value slot. */
3511 
3512         slot2 = PyInt_Type.tp_as_number->nb_true_divide;
3513     }
3514 
3515     if (slot1 != NULL) {
3516         PyObject *x = slot1(operand1, operand2);
3517 
3518         if (x != Py_NotImplemented) {
3519             obj_result = x;
3520             goto exit_binary_result_object;
3521         }
3522 
3523         Py_DECREF(x);
3524     }
3525 
3526     if (slot2 != NULL) {
3527         PyObject *x = slot2(operand1, operand2);
3528 
3529         if (x != Py_NotImplemented) {
3530             obj_result = x;
3531             goto exit_binary_result_object;
3532         }
3533 
3534         Py_DECREF(x);
3535     }
3536 
3537     // Statically recognized that coercion is not possible with these types
3538 
3539     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'float' and 'int'");
3540     goto exit_binary_exception;
3541 
3542 exit_binary_result_object:
3543     return obj_result;
3544 
3545 exit_binary_exception:
3546     return NULL;
3547 }
3548 
BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_INT(PyObject * operand1,PyObject * operand2)3549 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_INT(PyObject *operand1, PyObject *operand2) {
3550     return _BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_INT(operand1, operand2);
3551 }
3552 #endif
3553 
3554 #if PYTHON_VERSION < 0x300
3555 /* Code referring to "INT" corresponds to Python2 'int' and "FLOAT" to Python 'float'. */
_BINARY_OPERATION_TRUEDIV_NBOOL_INT_FLOAT(PyObject * operand1,PyObject * operand2)3556 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_INT_FLOAT(PyObject *operand1, PyObject *operand2) {
3557     CHECK_OBJECT(operand1);
3558     assert(PyInt_CheckExact(operand1));
3559 #if PYTHON_VERSION < 0x300
3560     assert(NEW_STYLE_NUMBER(operand1));
3561 #endif
3562     CHECK_OBJECT(operand2);
3563     assert(PyFloat_CheckExact(operand2));
3564 #if PYTHON_VERSION < 0x300
3565     assert(NEW_STYLE_NUMBER(operand2));
3566 #endif
3567 
3568     PyTypeObject *type1 = &PyInt_Type;
3569     PyTypeObject *type2 = &PyFloat_Type;
3570 
3571 #ifdef _MSC_VER
3572 #pragma warning(push)
3573 #pragma warning(disable : 4101)
3574 #endif
3575     NUITKA_MAY_BE_UNUSED bool cbool_result;
3576     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3577 #ifdef _MSC_VER
3578 #pragma warning(pop)
3579 #endif
3580 
3581     binaryfunc slot1 = PyInt_Type.tp_as_number->nb_true_divide;
3582     binaryfunc slot2 = NULL;
3583 
3584     if (!(0)) {
3585         assert(type1 != type2);
3586         /* Different types, need to consider second value slot. */
3587 
3588         slot2 = PyFloat_Type.tp_as_number->nb_true_divide;
3589     }
3590 
3591     if (slot1 != NULL) {
3592         PyObject *x = slot1(operand1, operand2);
3593 
3594         if (x != Py_NotImplemented) {
3595             obj_result = x;
3596             goto exit_binary_result_object;
3597         }
3598 
3599         Py_DECREF(x);
3600     }
3601 
3602     if (slot2 != NULL) {
3603         PyObject *x = slot2(operand1, operand2);
3604 
3605         if (x != Py_NotImplemented) {
3606             obj_result = x;
3607             goto exit_binary_result_object;
3608         }
3609 
3610         Py_DECREF(x);
3611     }
3612 
3613     // Statically recognized that coercion is not possible with these types
3614 
3615     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'int' and 'float'");
3616     goto exit_binary_exception;
3617 
3618 exit_binary_result_object:
3619     if (unlikely(obj_result == NULL)) {
3620         return NUITKA_BOOL_EXCEPTION;
3621     }
3622 
3623     {
3624         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3625         Py_DECREF(obj_result);
3626         return r;
3627     }
3628 
3629 exit_binary_exception:
3630     return NUITKA_BOOL_EXCEPTION;
3631 }
3632 
BINARY_OPERATION_TRUEDIV_NBOOL_INT_FLOAT(PyObject * operand1,PyObject * operand2)3633 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_INT_FLOAT(PyObject *operand1, PyObject *operand2) {
3634     return _BINARY_OPERATION_TRUEDIV_NBOOL_INT_FLOAT(operand1, operand2);
3635 }
3636 #endif
3637 
3638 #if PYTHON_VERSION < 0x300
3639 /* Code referring to "FLOAT" corresponds to Python 'float' and "INT" to Python2 'int'. */
_BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_INT(PyObject * operand1,PyObject * operand2)3640 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_INT(PyObject *operand1, PyObject *operand2) {
3641     CHECK_OBJECT(operand1);
3642     assert(PyFloat_CheckExact(operand1));
3643 #if PYTHON_VERSION < 0x300
3644     assert(NEW_STYLE_NUMBER(operand1));
3645 #endif
3646     CHECK_OBJECT(operand2);
3647     assert(PyInt_CheckExact(operand2));
3648 #if PYTHON_VERSION < 0x300
3649     assert(NEW_STYLE_NUMBER(operand2));
3650 #endif
3651 
3652     PyTypeObject *type1 = &PyFloat_Type;
3653     PyTypeObject *type2 = &PyInt_Type;
3654 
3655 #ifdef _MSC_VER
3656 #pragma warning(push)
3657 #pragma warning(disable : 4101)
3658 #endif
3659     NUITKA_MAY_BE_UNUSED bool cbool_result;
3660     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3661 #ifdef _MSC_VER
3662 #pragma warning(pop)
3663 #endif
3664 
3665     binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_true_divide;
3666     binaryfunc slot2 = NULL;
3667 
3668     if (!(0)) {
3669         assert(type1 != type2);
3670         /* Different types, need to consider second value slot. */
3671 
3672         slot2 = PyInt_Type.tp_as_number->nb_true_divide;
3673     }
3674 
3675     if (slot1 != NULL) {
3676         PyObject *x = slot1(operand1, operand2);
3677 
3678         if (x != Py_NotImplemented) {
3679             obj_result = x;
3680             goto exit_binary_result_object;
3681         }
3682 
3683         Py_DECREF(x);
3684     }
3685 
3686     if (slot2 != NULL) {
3687         PyObject *x = slot2(operand1, operand2);
3688 
3689         if (x != Py_NotImplemented) {
3690             obj_result = x;
3691             goto exit_binary_result_object;
3692         }
3693 
3694         Py_DECREF(x);
3695     }
3696 
3697     // Statically recognized that coercion is not possible with these types
3698 
3699     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'float' and 'int'");
3700     goto exit_binary_exception;
3701 
3702 exit_binary_result_object:
3703     if (unlikely(obj_result == NULL)) {
3704         return NUITKA_BOOL_EXCEPTION;
3705     }
3706 
3707     {
3708         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3709         Py_DECREF(obj_result);
3710         return r;
3711     }
3712 
3713 exit_binary_exception:
3714     return NUITKA_BOOL_EXCEPTION;
3715 }
3716 
BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_INT(PyObject * operand1,PyObject * operand2)3717 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_INT(PyObject *operand1, PyObject *operand2) {
3718     return _BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_INT(operand1, operand2);
3719 }
3720 #endif
3721 
3722 /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "FLOAT" to Python 'float'. */
_BINARY_OPERATION_TRUEDIV_OBJECT_LONG_FLOAT(PyObject * operand1,PyObject * operand2)3723 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_LONG_FLOAT(PyObject *operand1, PyObject *operand2) {
3724     CHECK_OBJECT(operand1);
3725     assert(PyLong_CheckExact(operand1));
3726 #if PYTHON_VERSION < 0x300
3727     assert(NEW_STYLE_NUMBER(operand1));
3728 #endif
3729     CHECK_OBJECT(operand2);
3730     assert(PyFloat_CheckExact(operand2));
3731 #if PYTHON_VERSION < 0x300
3732     assert(NEW_STYLE_NUMBER(operand2));
3733 #endif
3734 
3735     PyTypeObject *type1 = &PyLong_Type;
3736     PyTypeObject *type2 = &PyFloat_Type;
3737 
3738 #ifdef _MSC_VER
3739 #pragma warning(push)
3740 #pragma warning(disable : 4101)
3741 #endif
3742     NUITKA_MAY_BE_UNUSED bool cbool_result;
3743     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3744 #ifdef _MSC_VER
3745 #pragma warning(pop)
3746 #endif
3747 
3748     binaryfunc slot1 = PyLong_Type.tp_as_number->nb_true_divide;
3749     binaryfunc slot2 = NULL;
3750 
3751     if (!(0)) {
3752         assert(type1 != type2);
3753         /* Different types, need to consider second value slot. */
3754 
3755         slot2 = PyFloat_Type.tp_as_number->nb_true_divide;
3756     }
3757 
3758     if (slot1 != NULL) {
3759         PyObject *x = slot1(operand1, operand2);
3760 
3761         if (x != Py_NotImplemented) {
3762             obj_result = x;
3763             goto exit_binary_result_object;
3764         }
3765 
3766         Py_DECREF(x);
3767     }
3768 
3769     if (slot2 != NULL) {
3770         PyObject *x = slot2(operand1, operand2);
3771 
3772         if (x != Py_NotImplemented) {
3773             obj_result = x;
3774             goto exit_binary_result_object;
3775         }
3776 
3777         Py_DECREF(x);
3778     }
3779 
3780     // Statically recognized that coercion is not possible with these types
3781 
3782 #if PYTHON_VERSION < 0x300
3783     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'long' and 'float'");
3784 #else
3785     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'int' and 'float'");
3786 #endif
3787     goto exit_binary_exception;
3788 
3789 exit_binary_result_object:
3790     return obj_result;
3791 
3792 exit_binary_exception:
3793     return NULL;
3794 }
3795 
BINARY_OPERATION_TRUEDIV_OBJECT_LONG_FLOAT(PyObject * operand1,PyObject * operand2)3796 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_LONG_FLOAT(PyObject *operand1, PyObject *operand2) {
3797     return _BINARY_OPERATION_TRUEDIV_OBJECT_LONG_FLOAT(operand1, operand2);
3798 }
3799 
3800 /* Code referring to "FLOAT" corresponds to Python 'float' and "LONG" to Python2 'long', Python3 'int'. */
_BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_LONG(PyObject * operand1,PyObject * operand2)3801 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_LONG(PyObject *operand1, PyObject *operand2) {
3802     CHECK_OBJECT(operand1);
3803     assert(PyFloat_CheckExact(operand1));
3804 #if PYTHON_VERSION < 0x300
3805     assert(NEW_STYLE_NUMBER(operand1));
3806 #endif
3807     CHECK_OBJECT(operand2);
3808     assert(PyLong_CheckExact(operand2));
3809 #if PYTHON_VERSION < 0x300
3810     assert(NEW_STYLE_NUMBER(operand2));
3811 #endif
3812 
3813     PyTypeObject *type1 = &PyFloat_Type;
3814     PyTypeObject *type2 = &PyLong_Type;
3815 
3816 #ifdef _MSC_VER
3817 #pragma warning(push)
3818 #pragma warning(disable : 4101)
3819 #endif
3820     NUITKA_MAY_BE_UNUSED bool cbool_result;
3821     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3822 #ifdef _MSC_VER
3823 #pragma warning(pop)
3824 #endif
3825 
3826     binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_true_divide;
3827     binaryfunc slot2 = NULL;
3828 
3829     if (!(0)) {
3830         assert(type1 != type2);
3831         /* Different types, need to consider second value slot. */
3832 
3833         slot2 = PyLong_Type.tp_as_number->nb_true_divide;
3834     }
3835 
3836     if (slot1 != NULL) {
3837         PyObject *x = slot1(operand1, operand2);
3838 
3839         if (x != Py_NotImplemented) {
3840             obj_result = x;
3841             goto exit_binary_result_object;
3842         }
3843 
3844         Py_DECREF(x);
3845     }
3846 
3847     if (slot2 != NULL) {
3848         PyObject *x = slot2(operand1, operand2);
3849 
3850         if (x != Py_NotImplemented) {
3851             obj_result = x;
3852             goto exit_binary_result_object;
3853         }
3854 
3855         Py_DECREF(x);
3856     }
3857 
3858     // Statically recognized that coercion is not possible with these types
3859 
3860 #if PYTHON_VERSION < 0x300
3861     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'float' and 'long'");
3862 #else
3863     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'float' and 'int'");
3864 #endif
3865     goto exit_binary_exception;
3866 
3867 exit_binary_result_object:
3868     return obj_result;
3869 
3870 exit_binary_exception:
3871     return NULL;
3872 }
3873 
BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_LONG(PyObject * operand1,PyObject * operand2)3874 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_LONG(PyObject *operand1, PyObject *operand2) {
3875     return _BINARY_OPERATION_TRUEDIV_OBJECT_FLOAT_LONG(operand1, operand2);
3876 }
3877 
3878 /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "FLOAT" to Python 'float'. */
_BINARY_OPERATION_TRUEDIV_NBOOL_LONG_FLOAT(PyObject * operand1,PyObject * operand2)3879 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_LONG_FLOAT(PyObject *operand1, PyObject *operand2) {
3880     CHECK_OBJECT(operand1);
3881     assert(PyLong_CheckExact(operand1));
3882 #if PYTHON_VERSION < 0x300
3883     assert(NEW_STYLE_NUMBER(operand1));
3884 #endif
3885     CHECK_OBJECT(operand2);
3886     assert(PyFloat_CheckExact(operand2));
3887 #if PYTHON_VERSION < 0x300
3888     assert(NEW_STYLE_NUMBER(operand2));
3889 #endif
3890 
3891     PyTypeObject *type1 = &PyLong_Type;
3892     PyTypeObject *type2 = &PyFloat_Type;
3893 
3894 #ifdef _MSC_VER
3895 #pragma warning(push)
3896 #pragma warning(disable : 4101)
3897 #endif
3898     NUITKA_MAY_BE_UNUSED bool cbool_result;
3899     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3900 #ifdef _MSC_VER
3901 #pragma warning(pop)
3902 #endif
3903 
3904     binaryfunc slot1 = PyLong_Type.tp_as_number->nb_true_divide;
3905     binaryfunc slot2 = NULL;
3906 
3907     if (!(0)) {
3908         assert(type1 != type2);
3909         /* Different types, need to consider second value slot. */
3910 
3911         slot2 = PyFloat_Type.tp_as_number->nb_true_divide;
3912     }
3913 
3914     if (slot1 != NULL) {
3915         PyObject *x = slot1(operand1, operand2);
3916 
3917         if (x != Py_NotImplemented) {
3918             obj_result = x;
3919             goto exit_binary_result_object;
3920         }
3921 
3922         Py_DECREF(x);
3923     }
3924 
3925     if (slot2 != NULL) {
3926         PyObject *x = slot2(operand1, operand2);
3927 
3928         if (x != Py_NotImplemented) {
3929             obj_result = x;
3930             goto exit_binary_result_object;
3931         }
3932 
3933         Py_DECREF(x);
3934     }
3935 
3936     // Statically recognized that coercion is not possible with these types
3937 
3938 #if PYTHON_VERSION < 0x300
3939     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'long' and 'float'");
3940 #else
3941     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'int' and 'float'");
3942 #endif
3943     goto exit_binary_exception;
3944 
3945 exit_binary_result_object:
3946     if (unlikely(obj_result == NULL)) {
3947         return NUITKA_BOOL_EXCEPTION;
3948     }
3949 
3950     {
3951         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3952         Py_DECREF(obj_result);
3953         return r;
3954     }
3955 
3956 exit_binary_exception:
3957     return NUITKA_BOOL_EXCEPTION;
3958 }
3959 
BINARY_OPERATION_TRUEDIV_NBOOL_LONG_FLOAT(PyObject * operand1,PyObject * operand2)3960 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_LONG_FLOAT(PyObject *operand1, PyObject *operand2) {
3961     return _BINARY_OPERATION_TRUEDIV_NBOOL_LONG_FLOAT(operand1, operand2);
3962 }
3963 
3964 /* Code referring to "FLOAT" corresponds to Python 'float' and "LONG" to Python2 'long', Python3 'int'. */
_BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_LONG(PyObject * operand1,PyObject * operand2)3965 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_LONG(PyObject *operand1, PyObject *operand2) {
3966     CHECK_OBJECT(operand1);
3967     assert(PyFloat_CheckExact(operand1));
3968 #if PYTHON_VERSION < 0x300
3969     assert(NEW_STYLE_NUMBER(operand1));
3970 #endif
3971     CHECK_OBJECT(operand2);
3972     assert(PyLong_CheckExact(operand2));
3973 #if PYTHON_VERSION < 0x300
3974     assert(NEW_STYLE_NUMBER(operand2));
3975 #endif
3976 
3977     PyTypeObject *type1 = &PyFloat_Type;
3978     PyTypeObject *type2 = &PyLong_Type;
3979 
3980 #ifdef _MSC_VER
3981 #pragma warning(push)
3982 #pragma warning(disable : 4101)
3983 #endif
3984     NUITKA_MAY_BE_UNUSED bool cbool_result;
3985     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
3986 #ifdef _MSC_VER
3987 #pragma warning(pop)
3988 #endif
3989 
3990     binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_true_divide;
3991     binaryfunc slot2 = NULL;
3992 
3993     if (!(0)) {
3994         assert(type1 != type2);
3995         /* Different types, need to consider second value slot. */
3996 
3997         slot2 = PyLong_Type.tp_as_number->nb_true_divide;
3998     }
3999 
4000     if (slot1 != NULL) {
4001         PyObject *x = slot1(operand1, operand2);
4002 
4003         if (x != Py_NotImplemented) {
4004             obj_result = x;
4005             goto exit_binary_result_object;
4006         }
4007 
4008         Py_DECREF(x);
4009     }
4010 
4011     if (slot2 != NULL) {
4012         PyObject *x = slot2(operand1, operand2);
4013 
4014         if (x != Py_NotImplemented) {
4015             obj_result = x;
4016             goto exit_binary_result_object;
4017         }
4018 
4019         Py_DECREF(x);
4020     }
4021 
4022     // Statically recognized that coercion is not possible with these types
4023 
4024 #if PYTHON_VERSION < 0x300
4025     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'float' and 'long'");
4026 #else
4027     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: 'float' and 'int'");
4028 #endif
4029     goto exit_binary_exception;
4030 
4031 exit_binary_result_object:
4032     if (unlikely(obj_result == NULL)) {
4033         return NUITKA_BOOL_EXCEPTION;
4034     }
4035 
4036     {
4037         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4038         Py_DECREF(obj_result);
4039         return r;
4040     }
4041 
4042 exit_binary_exception:
4043     return NUITKA_BOOL_EXCEPTION;
4044 }
4045 
BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_LONG(PyObject * operand1,PyObject * operand2)4046 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_LONG(PyObject *operand1, PyObject *operand2) {
4047     return _BINARY_OPERATION_TRUEDIV_NBOOL_FLOAT_LONG(operand1, operand2);
4048 }
4049 
4050 /* Code referring to "OBJECT" corresponds to any Python object and "OBJECT" to any Python object. */
_BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_OBJECT(PyObject * operand1,PyObject * operand2)4051 static PyObject *_BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
4052     CHECK_OBJECT(operand1);
4053     CHECK_OBJECT(operand2);
4054 
4055 #if PYTHON_VERSION < 0x300
4056     if (PyInt_CheckExact(operand1) && PyInt_CheckExact(operand2)) {
4057         PyObject *result;
4058 
4059         // Not every code path will make use of all possible results.
4060 #ifdef _MSC_VER
4061 #pragma warning(push)
4062 #pragma warning(disable : 4101)
4063 #endif
4064         NUITKA_MAY_BE_UNUSED bool cbool_result;
4065         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4066         NUITKA_MAY_BE_UNUSED long clong_result;
4067         NUITKA_MAY_BE_UNUSED double cfloat_result;
4068 #ifdef _MSC_VER
4069 #pragma warning(pop)
4070 #endif
4071 
4072         CHECK_OBJECT(operand1);
4073         assert(PyInt_CheckExact(operand1));
4074 #if PYTHON_VERSION < 0x300
4075         assert(NEW_STYLE_NUMBER(operand1));
4076 #endif
4077         CHECK_OBJECT(operand2);
4078         assert(PyInt_CheckExact(operand2));
4079 #if PYTHON_VERSION < 0x300
4080         assert(NEW_STYLE_NUMBER(operand2));
4081 #endif
4082 
4083         const long a = PyInt_AS_LONG(operand1);
4084         const long b = PyInt_AS_LONG(operand2);
4085 
4086         if (unlikely(b == 0)) {
4087             SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "division by zero");
4088             goto exit_result_exception;
4089         }
4090 
4091         if (a == 0) {
4092             if (b < 0) {
4093                 goto exit_result_ok_const_float_minus_0_0;
4094             } else {
4095                 goto exit_result_ok_const_float_0_0;
4096             }
4097         }
4098 
4099 /* May need to resort to LONG code, which we currently do not
4100  * specialize yet. TODO: Once we do that, call it here instead.
4101  */
4102 #if DBL_MANT_DIG < WIDTH_OF_ULONG
4103         if ((a >= 0 ? 0UL + a : 0UL - a) >> DBL_MANT_DIG || (b >= 0 ? 0UL + b : 0UL - b) >> DBL_MANT_DIG) {
4104         } else
4105 #endif
4106         {
4107             double r = (double)a / (double)b;
4108 
4109             cfloat_result = r;
4110             goto exit_result_ok_cfloat;
4111         }
4112         {
4113             PyObject *operand1_object = operand1;
4114             PyObject *operand2_object = operand2;
4115 
4116             PyObject *r = PyLong_Type.tp_as_number->nb_true_divide(operand1_object, operand2_object);
4117             assert(r != Py_NotImplemented);
4118 
4119             obj_result = r;
4120             goto exit_result_object;
4121         }
4122 
4123     exit_result_ok_cfloat:
4124         result = PyFloat_FromDouble(cfloat_result);
4125         goto exit_result_ok;
4126 
4127     exit_result_object:
4128         if (unlikely(obj_result == NULL)) {
4129             goto exit_result_exception;
4130         }
4131         result = obj_result;
4132         goto exit_result_ok;
4133 
4134     exit_result_ok_const_float_0_0:
4135         Py_INCREF(const_float_0_0);
4136         result = const_float_0_0;
4137         goto exit_result_ok;
4138 
4139     exit_result_ok_const_float_minus_0_0:
4140         Py_INCREF(const_float_minus_0_0);
4141         result = const_float_minus_0_0;
4142         goto exit_result_ok;
4143 
4144     exit_result_ok:
4145         return result;
4146 
4147     exit_result_exception:
4148         return NULL;
4149     }
4150 #endif
4151 
4152     PyTypeObject *type1 = Py_TYPE(operand1);
4153     PyTypeObject *type2 = Py_TYPE(operand2);
4154 
4155 #ifdef _MSC_VER
4156 #pragma warning(push)
4157 #pragma warning(disable : 4101)
4158 #endif
4159     NUITKA_MAY_BE_UNUSED bool cbool_result;
4160     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4161 #ifdef _MSC_VER
4162 #pragma warning(pop)
4163 #endif
4164 
4165     binaryfunc slot1 =
4166         (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
4167     binaryfunc slot2 = NULL;
4168 
4169     if (!(type1 == type2)) {
4170         assert(type1 != type2);
4171         /* Different types, need to consider second value slot. */
4172 
4173         slot2 =
4174             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide : NULL;
4175 
4176         if (slot1 == slot2) {
4177             slot2 = NULL;
4178         }
4179     }
4180 
4181     if (slot1 != NULL) {
4182         if (slot2 != NULL) {
4183             if (PyType_IsSubtype(type2, type1)) {
4184                 PyObject *x = slot2(operand1, operand2);
4185 
4186                 if (x != Py_NotImplemented) {
4187                     obj_result = x;
4188                     goto exit_binary_result_object;
4189                 }
4190 
4191                 Py_DECREF(x);
4192                 slot2 = NULL;
4193             }
4194         }
4195 
4196         PyObject *x = slot1(operand1, operand2);
4197 
4198         if (x != Py_NotImplemented) {
4199             obj_result = x;
4200             goto exit_binary_result_object;
4201         }
4202 
4203         Py_DECREF(x);
4204     }
4205 
4206     if (slot2 != NULL) {
4207         PyObject *x = slot2(operand1, operand2);
4208 
4209         if (x != Py_NotImplemented) {
4210             obj_result = x;
4211             goto exit_binary_result_object;
4212         }
4213 
4214         Py_DECREF(x);
4215     }
4216 
4217 #if PYTHON_VERSION < 0x300
4218     if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
4219         coercion c1 =
4220             (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
4221 
4222         if (c1 != NULL) {
4223             PyObject *coerced1 = operand1;
4224             PyObject *coerced2 = operand2;
4225 
4226             int err = c1(&coerced1, &coerced2);
4227 
4228             if (unlikely(err < 0)) {
4229                 goto exit_binary_exception;
4230             }
4231 
4232             if (err == 0) {
4233                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4234 
4235                 if (likely(mv == NULL)) {
4236                     binaryfunc slot = mv->nb_true_divide;
4237 
4238                     if (likely(slot != NULL)) {
4239                         PyObject *x = slot(coerced1, coerced2);
4240 
4241                         Py_DECREF(coerced1);
4242                         Py_DECREF(coerced2);
4243 
4244                         obj_result = x;
4245                         goto exit_binary_result_object;
4246                     }
4247                 }
4248 
4249                 // nb_coerce took a reference.
4250                 Py_DECREF(coerced1);
4251                 Py_DECREF(coerced2);
4252             }
4253         }
4254         coercion c2 =
4255             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4256 
4257         if (c2 != NULL) {
4258             PyObject *coerced1 = operand1;
4259             PyObject *coerced2 = operand2;
4260 
4261             int err = c2(&coerced2, &coerced1);
4262 
4263             if (unlikely(err < 0)) {
4264                 goto exit_binary_exception;
4265             }
4266 
4267             if (err == 0) {
4268                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4269 
4270                 if (likely(mv == NULL)) {
4271                     binaryfunc slot = mv->nb_true_divide;
4272 
4273                     if (likely(slot != NULL)) {
4274                         PyObject *x = slot(coerced1, coerced2);
4275 
4276                         Py_DECREF(coerced1);
4277                         Py_DECREF(coerced2);
4278 
4279                         obj_result = x;
4280                         goto exit_binary_result_object;
4281                     }
4282                 }
4283 
4284                 // nb_coerce took a reference.
4285                 Py_DECREF(coerced1);
4286                 Py_DECREF(coerced2);
4287             }
4288         }
4289     }
4290 #endif
4291 
4292     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and '%s'", type1->tp_name, type2->tp_name);
4293     goto exit_binary_exception;
4294 
4295 exit_binary_result_object:
4296     return obj_result;
4297 
4298 exit_binary_exception:
4299     return NULL;
4300 }
4301 
BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_OBJECT(PyObject * operand1,PyObject * operand2)4302 PyObject *BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
4303     return _BINARY_OPERATION_TRUEDIV_OBJECT_OBJECT_OBJECT(operand1, operand2);
4304 }
4305 
4306 /* Code referring to "OBJECT" corresponds to any Python object and "OBJECT" to any Python object. */
_BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_OBJECT(PyObject * operand1,PyObject * operand2)4307 static nuitka_bool _BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
4308     CHECK_OBJECT(operand1);
4309     CHECK_OBJECT(operand2);
4310 
4311 #if PYTHON_VERSION < 0x300
4312     if (PyInt_CheckExact(operand1) && PyInt_CheckExact(operand2)) {
4313         nuitka_bool result;
4314 
4315         // Not every code path will make use of all possible results.
4316 #ifdef _MSC_VER
4317 #pragma warning(push)
4318 #pragma warning(disable : 4101)
4319 #endif
4320         NUITKA_MAY_BE_UNUSED bool cbool_result;
4321         NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4322         NUITKA_MAY_BE_UNUSED long clong_result;
4323         NUITKA_MAY_BE_UNUSED double cfloat_result;
4324 #ifdef _MSC_VER
4325 #pragma warning(pop)
4326 #endif
4327 
4328         CHECK_OBJECT(operand1);
4329         assert(PyInt_CheckExact(operand1));
4330 #if PYTHON_VERSION < 0x300
4331         assert(NEW_STYLE_NUMBER(operand1));
4332 #endif
4333         CHECK_OBJECT(operand2);
4334         assert(PyInt_CheckExact(operand2));
4335 #if PYTHON_VERSION < 0x300
4336         assert(NEW_STYLE_NUMBER(operand2));
4337 #endif
4338 
4339         const long a = PyInt_AS_LONG(operand1);
4340         const long b = PyInt_AS_LONG(operand2);
4341 
4342         if (unlikely(b == 0)) {
4343             SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_ZeroDivisionError, "division by zero");
4344             goto exit_result_exception;
4345         }
4346 
4347         cbool_result = a == 0;
4348         goto exit_result_ok_cbool;
4349 
4350     exit_result_ok_cbool:
4351         result = cbool_result ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4352         goto exit_result_ok;
4353 
4354     exit_result_ok:
4355         return result;
4356 
4357     exit_result_exception:
4358         return NUITKA_BOOL_EXCEPTION;
4359     }
4360 #endif
4361 
4362     PyTypeObject *type1 = Py_TYPE(operand1);
4363     PyTypeObject *type2 = Py_TYPE(operand2);
4364 
4365 #ifdef _MSC_VER
4366 #pragma warning(push)
4367 #pragma warning(disable : 4101)
4368 #endif
4369     NUITKA_MAY_BE_UNUSED bool cbool_result;
4370     NUITKA_MAY_BE_UNUSED PyObject *obj_result;
4371 #ifdef _MSC_VER
4372 #pragma warning(pop)
4373 #endif
4374 
4375     binaryfunc slot1 =
4376         (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_true_divide : NULL;
4377     binaryfunc slot2 = NULL;
4378 
4379     if (!(type1 == type2)) {
4380         assert(type1 != type2);
4381         /* Different types, need to consider second value slot. */
4382 
4383         slot2 =
4384             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_true_divide : NULL;
4385 
4386         if (slot1 == slot2) {
4387             slot2 = NULL;
4388         }
4389     }
4390 
4391     if (slot1 != NULL) {
4392         if (slot2 != NULL) {
4393             if (PyType_IsSubtype(type2, type1)) {
4394                 PyObject *x = slot2(operand1, operand2);
4395 
4396                 if (x != Py_NotImplemented) {
4397                     obj_result = x;
4398                     goto exit_binary_result_object;
4399                 }
4400 
4401                 Py_DECREF(x);
4402                 slot2 = NULL;
4403             }
4404         }
4405 
4406         PyObject *x = slot1(operand1, operand2);
4407 
4408         if (x != Py_NotImplemented) {
4409             obj_result = x;
4410             goto exit_binary_result_object;
4411         }
4412 
4413         Py_DECREF(x);
4414     }
4415 
4416     if (slot2 != NULL) {
4417         PyObject *x = slot2(operand1, operand2);
4418 
4419         if (x != Py_NotImplemented) {
4420             obj_result = x;
4421             goto exit_binary_result_object;
4422         }
4423 
4424         Py_DECREF(x);
4425     }
4426 
4427 #if PYTHON_VERSION < 0x300
4428     if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
4429         coercion c1 =
4430             (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
4431 
4432         if (c1 != NULL) {
4433             PyObject *coerced1 = operand1;
4434             PyObject *coerced2 = operand2;
4435 
4436             int err = c1(&coerced1, &coerced2);
4437 
4438             if (unlikely(err < 0)) {
4439                 goto exit_binary_exception;
4440             }
4441 
4442             if (err == 0) {
4443                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4444 
4445                 if (likely(mv == NULL)) {
4446                     binaryfunc slot = mv->nb_true_divide;
4447 
4448                     if (likely(slot != NULL)) {
4449                         PyObject *x = slot(coerced1, coerced2);
4450 
4451                         Py_DECREF(coerced1);
4452                         Py_DECREF(coerced2);
4453 
4454                         obj_result = x;
4455                         goto exit_binary_result_object;
4456                     }
4457                 }
4458 
4459                 // nb_coerce took a reference.
4460                 Py_DECREF(coerced1);
4461                 Py_DECREF(coerced2);
4462             }
4463         }
4464         coercion c2 =
4465             (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
4466 
4467         if (c2 != NULL) {
4468             PyObject *coerced1 = operand1;
4469             PyObject *coerced2 = operand2;
4470 
4471             int err = c2(&coerced2, &coerced1);
4472 
4473             if (unlikely(err < 0)) {
4474                 goto exit_binary_exception;
4475             }
4476 
4477             if (err == 0) {
4478                 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
4479 
4480                 if (likely(mv == NULL)) {
4481                     binaryfunc slot = mv->nb_true_divide;
4482 
4483                     if (likely(slot != NULL)) {
4484                         PyObject *x = slot(coerced1, coerced2);
4485 
4486                         Py_DECREF(coerced1);
4487                         Py_DECREF(coerced2);
4488 
4489                         obj_result = x;
4490                         goto exit_binary_result_object;
4491                     }
4492                 }
4493 
4494                 // nb_coerce took a reference.
4495                 Py_DECREF(coerced1);
4496                 Py_DECREF(coerced2);
4497             }
4498         }
4499     }
4500 #endif
4501 
4502     PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and '%s'", type1->tp_name, type2->tp_name);
4503     goto exit_binary_exception;
4504 
4505 exit_binary_result_object:
4506     if (unlikely(obj_result == NULL)) {
4507         return NUITKA_BOOL_EXCEPTION;
4508     }
4509 
4510     {
4511         nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4512         Py_DECREF(obj_result);
4513         return r;
4514     }
4515 
4516 exit_binary_exception:
4517     return NUITKA_BOOL_EXCEPTION;
4518 }
4519 
BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_OBJECT(PyObject * operand1,PyObject * operand2)4520 nuitka_bool BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
4521     return _BINARY_OPERATION_TRUEDIV_NBOOL_OBJECT_OBJECT(operand1, operand2);
4522 }
4523