7#include "nuitka/prelude.h"
12#if PYTHON_VERSION < 0x300
13static PyObject *COMPARE_GE_OBJECT_INT_INT(PyObject *operand1, PyObject *operand2) {
14 CHECK_OBJECT(operand1);
15 assert(PyInt_CheckExact(operand1));
16 CHECK_OBJECT(operand2);
17 assert(PyInt_CheckExact(operand2));
19 const long a = PyInt_AS_LONG(operand1);
20 const long b = PyInt_AS_LONG(operand2);
25 PyObject *result = BOOL_FROM(r);
26 Py_INCREF_IMMORTAL(result);
30#if PYTHON_VERSION < 0x300
31static bool COMPARE_GE_CBOOL_INT_INT(PyObject *operand1, PyObject *operand2) {
32 CHECK_OBJECT(operand1);
33 assert(PyInt_CheckExact(operand1));
34 CHECK_OBJECT(operand2);
35 assert(PyInt_CheckExact(operand2));
37 const long a = PyInt_AS_LONG(operand1);
38 const long b = PyInt_AS_LONG(operand2);
49PyObject *RICH_COMPARE_GE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
51#if PYTHON_VERSION < 0x300
52 if (PyInt_CheckExact(operand1) && PyInt_CheckExact(operand2)) {
53 return COMPARE_GE_OBJECT_INT_INT(operand1, operand2);
58 if (operand1 == operand2 && IS_SANE_TYPE(Py_TYPE(operand1))) {
60 PyObject *result = BOOL_FROM(r);
61 Py_INCREF_IMMORTAL(result);
65#if PYTHON_VERSION < 0x300
66 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
70 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
75 PyTypeObject *type1 = Py_TYPE(operand1);
76 PyTypeObject *type2 = Py_TYPE(operand2);
78#if PYTHON_VERSION < 0x300
80 if (type1 == type2 && !PyInstance_Check(operand1)) {
82 richcmpfunc frich = TP_RICHCOMPARE(type1);
85 PyObject *result = (*frich)(operand1, operand2, Py_GE);
87 if (result != Py_NotImplemented) {
88 Py_LeaveRecursiveCall();
93 Py_DECREF_IMMORTAL(result);
97 cmpfunc fcmp = type1->tp_compare;
100 int c = (*fcmp)(operand1, operand2);
101 c = adjust_tp_compare(c);
103 Py_LeaveRecursiveCall();
129 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
133 PyObject *result = BOOL_FROM(r);
134 Py_INCREF_IMMORTAL(result);
142 if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
143 f = TP_RICHCOMPARE(type2);
146 PyObject *result = (*f)(operand2, operand1, Py_LE);
148 if (result != Py_NotImplemented) {
149 Py_LeaveRecursiveCall();
154 Py_DECREF_IMMORTAL(result);
158 f = TP_RICHCOMPARE(type1);
160 PyObject *result = (*f)(operand1, operand2, Py_GE);
162 if (result != Py_NotImplemented) {
163 Py_LeaveRecursiveCall();
168 Py_DECREF_IMMORTAL(result);
171 f = TP_RICHCOMPARE(type2);
173 PyObject *result = (*f)(operand2, operand1, Py_LE);
175 if (result != Py_NotImplemented) {
176 Py_LeaveRecursiveCall();
181 Py_DECREF_IMMORTAL(result);
186 if (PyInstance_Check(operand1)) {
187 cmpfunc fcmp = type1->tp_compare;
188 c = (*fcmp)(operand1, operand2);
189 }
else if (PyInstance_Check(operand2)) {
190 cmpfunc fcmp = type2->tp_compare;
191 c = (*fcmp)(operand1, operand2);
193 c = try_3way_compare(operand1, operand2);
197 if (type1 == type2) {
198 Py_uintptr_t aa = (Py_uintptr_t)operand1;
199 Py_uintptr_t bb = (Py_uintptr_t)operand2;
201 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
202 }
else if (operand1 == Py_None) {
205 }
else if (operand2 == Py_None) {
208 }
else if (PyNumber_Check(operand1)) {
211 if (PyNumber_Check(operand2)) {
213 Py_uintptr_t aa = (Py_uintptr_t)type1;
214 Py_uintptr_t bb = (Py_uintptr_t)type2;
216 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
220 }
else if (PyNumber_Check(operand2)) {
224 int s = strcmp(type1->tp_name, type2->tp_name);
232 Py_uintptr_t aa = (Py_uintptr_t)type1;
233 Py_uintptr_t bb = (Py_uintptr_t)type2;
235 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
240 Py_LeaveRecursiveCall();
242 if (unlikely(c <= -2)) {
268 PyObject *result = BOOL_FROM(r);
269 Py_INCREF_IMMORTAL(result);
272 bool checked_reverse_op =
false;
275 if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
276 f = TP_RICHCOMPARE(type2);
279 checked_reverse_op =
true;
281 PyObject *result = (*f)(operand2, operand1, Py_LE);
283 if (result != Py_NotImplemented) {
284 Py_LeaveRecursiveCall();
289 Py_DECREF_IMMORTAL(result);
293 f = TP_RICHCOMPARE(type1);
296 PyObject *result = (*f)(operand1, operand2, Py_GE);
298 if (result != Py_NotImplemented) {
299 Py_LeaveRecursiveCall();
304 Py_DECREF_IMMORTAL(result);
307 if (checked_reverse_op ==
false) {
308 f = TP_RICHCOMPARE(type2);
311 PyObject *result = (*f)(operand2, operand1, Py_LE);
313 if (result != Py_NotImplemented) {
314 Py_LeaveRecursiveCall();
319 Py_DECREF_IMMORTAL(result);
323 Py_LeaveRecursiveCall();
329 bool r = operand1 == operand2;
330 PyObject *result = BOOL_FROM(r);
331 Py_INCREF_IMMORTAL(result);
335 bool r = operand1 != operand2;
336 PyObject *result = BOOL_FROM(r);
337 Py_INCREF_IMMORTAL(result);
341#if PYTHON_VERSION < 0x360
342 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= %s()", type1->tp_name, type2->tp_name);
344 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and '%s'", type1->tp_name,
353nuitka_bool RICH_COMPARE_GE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
355#if PYTHON_VERSION < 0x300
356 if (PyInt_CheckExact(operand1) && PyInt_CheckExact(operand2)) {
357 return COMPARE_GE_CBOOL_INT_INT(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
362 if (operand1 == operand2 && IS_SANE_TYPE(Py_TYPE(operand1))) {
364 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
369#if PYTHON_VERSION < 0x300
370 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
371 return NUITKA_BOOL_EXCEPTION;
374 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
375 return NUITKA_BOOL_EXCEPTION;
379 PyTypeObject *type1 = Py_TYPE(operand1);
380 PyTypeObject *type2 = Py_TYPE(operand2);
382#if PYTHON_VERSION < 0x300
384 if (type1 == type2 && !PyInstance_Check(operand1)) {
386 richcmpfunc frich = TP_RICHCOMPARE(type1);
389 PyObject *result = (*frich)(operand1, operand2, Py_GE);
391 if (result != Py_NotImplemented) {
392 Py_LeaveRecursiveCall();
394 if (unlikely(result == NULL)) {
395 return NUITKA_BOOL_EXCEPTION;
399 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
405 Py_DECREF_IMMORTAL(result);
409 cmpfunc fcmp = type1->tp_compare;
412 int c = (*fcmp)(operand1, operand2);
413 c = adjust_tp_compare(c);
415 Py_LeaveRecursiveCall();
418 return NUITKA_BOOL_EXCEPTION;
441 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
445 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
454 if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
455 f = TP_RICHCOMPARE(type2);
458 PyObject *result = (*f)(operand2, operand1, Py_LE);
460 if (result != Py_NotImplemented) {
461 Py_LeaveRecursiveCall();
463 if (unlikely(result == NULL)) {
464 return NUITKA_BOOL_EXCEPTION;
468 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
474 Py_DECREF_IMMORTAL(result);
478 f = TP_RICHCOMPARE(type1);
480 PyObject *result = (*f)(operand1, operand2, Py_GE);
482 if (result != Py_NotImplemented) {
483 Py_LeaveRecursiveCall();
485 if (unlikely(result == NULL)) {
486 return NUITKA_BOOL_EXCEPTION;
490 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
496 Py_DECREF_IMMORTAL(result);
499 f = TP_RICHCOMPARE(type2);
501 PyObject *result = (*f)(operand2, operand1, Py_LE);
503 if (result != Py_NotImplemented) {
504 Py_LeaveRecursiveCall();
506 if (unlikely(result == NULL)) {
507 return NUITKA_BOOL_EXCEPTION;
511 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
517 Py_DECREF_IMMORTAL(result);
522 if (PyInstance_Check(operand1)) {
523 cmpfunc fcmp = type1->tp_compare;
524 c = (*fcmp)(operand1, operand2);
525 }
else if (PyInstance_Check(operand2)) {
526 cmpfunc fcmp = type2->tp_compare;
527 c = (*fcmp)(operand1, operand2);
529 c = try_3way_compare(operand1, operand2);
533 if (type1 == type2) {
534 Py_uintptr_t aa = (Py_uintptr_t)operand1;
535 Py_uintptr_t bb = (Py_uintptr_t)operand2;
537 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
538 }
else if (operand1 == Py_None) {
541 }
else if (operand2 == Py_None) {
544 }
else if (PyNumber_Check(operand1)) {
547 if (PyNumber_Check(operand2)) {
549 Py_uintptr_t aa = (Py_uintptr_t)type1;
550 Py_uintptr_t bb = (Py_uintptr_t)type2;
552 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
556 }
else if (PyNumber_Check(operand2)) {
560 int s = strcmp(type1->tp_name, type2->tp_name);
568 Py_uintptr_t aa = (Py_uintptr_t)type1;
569 Py_uintptr_t bb = (Py_uintptr_t)type2;
571 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
576 Py_LeaveRecursiveCall();
578 if (unlikely(c <= -2)) {
579 return NUITKA_BOOL_EXCEPTION;
604 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
608 bool checked_reverse_op =
false;
611 if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
612 f = TP_RICHCOMPARE(type2);
615 checked_reverse_op =
true;
617 PyObject *result = (*f)(operand2, operand1, Py_LE);
619 if (result != Py_NotImplemented) {
620 Py_LeaveRecursiveCall();
622 if (unlikely(result == NULL)) {
623 return NUITKA_BOOL_EXCEPTION;
627 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
633 Py_DECREF_IMMORTAL(result);
637 f = TP_RICHCOMPARE(type1);
640 PyObject *result = (*f)(operand1, operand2, Py_GE);
642 if (result != Py_NotImplemented) {
643 Py_LeaveRecursiveCall();
645 if (unlikely(result == NULL)) {
646 return NUITKA_BOOL_EXCEPTION;
650 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
656 Py_DECREF_IMMORTAL(result);
659 if (checked_reverse_op ==
false) {
660 f = TP_RICHCOMPARE(type2);
663 PyObject *result = (*f)(operand2, operand1, Py_LE);
665 if (result != Py_NotImplemented) {
666 Py_LeaveRecursiveCall();
668 if (unlikely(result == NULL)) {
669 return NUITKA_BOOL_EXCEPTION;
673 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
679 Py_DECREF_IMMORTAL(result);
683 Py_LeaveRecursiveCall();
689 bool r = operand1 == operand2;
690 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
695 bool r = operand1 != operand2;
696 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
701#if PYTHON_VERSION < 0x360
702 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= %s()", type1->tp_name, type2->tp_name);
704 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and '%s'", type1->tp_name,
707 return NUITKA_BOOL_EXCEPTION;
712#if PYTHON_VERSION < 0x300
713static PyObject *COMPARE_GE_OBJECT_STR_STR(PyObject *operand1, PyObject *operand2) {
714 CHECK_OBJECT(operand1);
715 assert(PyString_CheckExact(operand1));
716 CHECK_OBJECT(operand2);
717 assert(PyString_CheckExact(operand2));
719 PyStringObject *a = (PyStringObject *)operand1;
720 PyStringObject *b = (PyStringObject *)operand2;
723 if (operand1 == operand2) {
727 PyObject *result = BOOL_FROM(r);
728 Py_INCREF_IMMORTAL(result);
732 Py_ssize_t len_a = Py_SIZE(operand1);
733 Py_ssize_t len_b = Py_SIZE(operand2);
735 Py_ssize_t min_len = (len_a < len_b) ? len_a : len_b;
739 c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval);
742 c = memcmp(a->ob_sval, b->ob_sval, min_len);
749 c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0;
755 PyObject *result = BOOL_FROM(c != 0);
756 Py_INCREF_IMMORTAL(result);
760#if PYTHON_VERSION < 0x300
762PyObject *RICH_COMPARE_GE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
764 if (Py_TYPE(operand1) == &PyString_Type) {
765 return COMPARE_GE_OBJECT_STR_STR(operand1, operand2);
768#if PYTHON_VERSION < 0x300
769 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
773 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
778 PyTypeObject *type1 = Py_TYPE(operand1);
780#if PYTHON_VERSION < 0x300
782 if (type1 == &PyString_Type && !0) {
784 richcmpfunc frich = PyString_Type.tp_richcompare;
787 PyObject *result = (*frich)(operand1, operand2, Py_GE);
789 if (result != Py_NotImplemented) {
790 Py_LeaveRecursiveCall();
795 Py_DECREF_IMMORTAL(result);
802 int c = (*fcmp)(operand1, operand2);
803 c = adjust_tp_compare(c);
805 Py_LeaveRecursiveCall();
831 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
835 PyObject *result = BOOL_FROM(r);
836 Py_INCREF_IMMORTAL(result);
844 if (type1 != &PyString_Type && 0) {
845 f = PyString_Type.tp_richcompare;
848 PyObject *result = (*f)(operand2, operand1, Py_LE);
850 if (result != Py_NotImplemented) {
851 Py_LeaveRecursiveCall();
856 Py_DECREF_IMMORTAL(result);
860 f = TP_RICHCOMPARE(type1);
862 PyObject *result = (*f)(operand1, operand2, Py_GE);
864 if (result != Py_NotImplemented) {
865 Py_LeaveRecursiveCall();
870 Py_DECREF_IMMORTAL(result);
873 f = PyString_Type.tp_richcompare;
875 PyObject *result = (*f)(operand2, operand1, Py_LE);
877 if (result != Py_NotImplemented) {
878 Py_LeaveRecursiveCall();
883 Py_DECREF_IMMORTAL(result);
888 if (PyInstance_Check(operand1)) {
889 cmpfunc fcmp = type1->tp_compare;
890 c = (*fcmp)(operand1, operand2);
893 c = (*fcmp)(operand1, operand2);
895 c = try_3way_compare(operand1, operand2);
899 if (type1 == &PyString_Type) {
900 Py_uintptr_t aa = (Py_uintptr_t)operand1;
901 Py_uintptr_t bb = (Py_uintptr_t)operand2;
903 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
904 }
else if (operand1 == Py_None) {
907 }
else if (operand2 == Py_None) {
910 }
else if (PyNumber_Check(operand1)) {
913 if (PyNumber_Check(operand2)) {
915 Py_uintptr_t aa = (Py_uintptr_t)type1;
916 Py_uintptr_t bb = (Py_uintptr_t)&PyString_Type;
918 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
922 }
else if (PyNumber_Check(operand2)) {
926 int s = strcmp(type1->tp_name,
"str");
934 Py_uintptr_t aa = (Py_uintptr_t)type1;
935 Py_uintptr_t bb = (Py_uintptr_t)&PyString_Type;
937 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
942 Py_LeaveRecursiveCall();
944 if (unlikely(c <= -2)) {
970 PyObject *result = BOOL_FROM(r);
971 Py_INCREF_IMMORTAL(result);
974 bool checked_reverse_op =
false;
977 if (type1 != &PyString_Type && Nuitka_Type_IsSubtype(&PyString_Type, type1)) {
978 f = PyString_Type.tp_richcompare;
981 checked_reverse_op =
true;
983 PyObject *result = (*f)(operand2, operand1, Py_LE);
985 if (result != Py_NotImplemented) {
986 Py_LeaveRecursiveCall();
991 Py_DECREF_IMMORTAL(result);
995 f = TP_RICHCOMPARE(type1);
998 PyObject *result = (*f)(operand1, operand2, Py_GE);
1000 if (result != Py_NotImplemented) {
1001 Py_LeaveRecursiveCall();
1006 Py_DECREF_IMMORTAL(result);
1009 if (checked_reverse_op ==
false) {
1010 f = PyString_Type.tp_richcompare;
1013 PyObject *result = (*f)(operand2, operand1, Py_LE);
1015 if (result != Py_NotImplemented) {
1016 Py_LeaveRecursiveCall();
1021 Py_DECREF_IMMORTAL(result);
1025 Py_LeaveRecursiveCall();
1031 bool r = operand1 == operand2;
1032 PyObject *result = BOOL_FROM(r);
1033 Py_INCREF_IMMORTAL(result);
1037 bool r = operand1 != operand2;
1038 PyObject *result = BOOL_FROM(r);
1039 Py_INCREF_IMMORTAL(result);
1043#if PYTHON_VERSION < 0x360
1044 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= str()", type1->tp_name);
1046 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'str'", type1->tp_name);
1054#if PYTHON_VERSION < 0x300
1056PyObject *RICH_COMPARE_GE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operand2) {
1058 if (&PyString_Type == Py_TYPE(operand2)) {
1059 return COMPARE_GE_OBJECT_STR_STR(operand1, operand2);
1062#if PYTHON_VERSION < 0x300
1063 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
1067 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
1072 PyTypeObject *type2 = Py_TYPE(operand2);
1074#if PYTHON_VERSION < 0x300
1076 if (&PyString_Type == type2 && !0) {
1078 richcmpfunc frich = PyString_Type.tp_richcompare;
1080 if (frich != NULL) {
1081 PyObject *result = (*frich)(operand1, operand2, Py_GE);
1083 if (result != Py_NotImplemented) {
1084 Py_LeaveRecursiveCall();
1089 Py_DECREF_IMMORTAL(result);
1093 cmpfunc fcmp = NULL;
1096 int c = (*fcmp)(operand1, operand2);
1097 c = adjust_tp_compare(c);
1099 Py_LeaveRecursiveCall();
1125 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
1129 PyObject *result = BOOL_FROM(r);
1130 Py_INCREF_IMMORTAL(result);
1138 if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1139 f = TP_RICHCOMPARE(type2);
1142 PyObject *result = (*f)(operand2, operand1, Py_LE);
1144 if (result != Py_NotImplemented) {
1145 Py_LeaveRecursiveCall();
1150 Py_DECREF_IMMORTAL(result);
1154 f = PyString_Type.tp_richcompare;
1156 PyObject *result = (*f)(operand1, operand2, Py_GE);
1158 if (result != Py_NotImplemented) {
1159 Py_LeaveRecursiveCall();
1164 Py_DECREF_IMMORTAL(result);
1167 f = TP_RICHCOMPARE(type2);
1169 PyObject *result = (*f)(operand2, operand1, Py_LE);
1171 if (result != Py_NotImplemented) {
1172 Py_LeaveRecursiveCall();
1177 Py_DECREF_IMMORTAL(result);
1183 cmpfunc fcmp = NULL;
1184 c = (*fcmp)(operand1, operand2);
1185 }
else if (PyInstance_Check(operand2)) {
1186 cmpfunc fcmp = type2->tp_compare;
1187 c = (*fcmp)(operand1, operand2);
1189 c = try_3way_compare(operand1, operand2);
1193 if (&PyString_Type == type2) {
1194 Py_uintptr_t aa = (Py_uintptr_t)operand1;
1195 Py_uintptr_t bb = (Py_uintptr_t)operand2;
1197 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1198 }
else if (operand1 == Py_None) {
1201 }
else if (operand2 == Py_None) {
1204 }
else if (PyNumber_Check(operand1)) {
1207 if (PyNumber_Check(operand2)) {
1209 Py_uintptr_t aa = (Py_uintptr_t)&PyString_Type;
1210 Py_uintptr_t bb = (Py_uintptr_t)type2;
1212 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1216 }
else if (PyNumber_Check(operand2)) {
1220 int s = strcmp(
"str", type2->tp_name);
1228 Py_uintptr_t aa = (Py_uintptr_t)&PyString_Type;
1229 Py_uintptr_t bb = (Py_uintptr_t)type2;
1231 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1236 Py_LeaveRecursiveCall();
1238 if (unlikely(c <= -2)) {
1264 PyObject *result = BOOL_FROM(r);
1265 Py_INCREF_IMMORTAL(result);
1268 bool checked_reverse_op =
false;
1271 if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1272 f = TP_RICHCOMPARE(type2);
1275 checked_reverse_op =
true;
1277 PyObject *result = (*f)(operand2, operand1, Py_LE);
1279 if (result != Py_NotImplemented) {
1280 Py_LeaveRecursiveCall();
1285 Py_DECREF_IMMORTAL(result);
1289 f = PyString_Type.tp_richcompare;
1292 PyObject *result = (*f)(operand1, operand2, Py_GE);
1294 if (result != Py_NotImplemented) {
1295 Py_LeaveRecursiveCall();
1300 Py_DECREF_IMMORTAL(result);
1303 if (checked_reverse_op ==
false) {
1304 f = TP_RICHCOMPARE(type2);
1307 PyObject *result = (*f)(operand2, operand1, Py_LE);
1309 if (result != Py_NotImplemented) {
1310 Py_LeaveRecursiveCall();
1315 Py_DECREF_IMMORTAL(result);
1319 Py_LeaveRecursiveCall();
1325 bool r = operand1 == operand2;
1326 PyObject *result = BOOL_FROM(r);
1327 Py_INCREF_IMMORTAL(result);
1331 bool r = operand1 != operand2;
1332 PyObject *result = BOOL_FROM(r);
1333 Py_INCREF_IMMORTAL(result);
1337#if PYTHON_VERSION < 0x360
1338 PyErr_Format(PyExc_TypeError,
"unorderable types: str() >= %s()", type2->tp_name);
1340 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'str' and '%s'", type2->tp_name);
1348#if PYTHON_VERSION < 0x300
1349static bool COMPARE_GE_CBOOL_STR_STR(PyObject *operand1, PyObject *operand2) {
1350 CHECK_OBJECT(operand1);
1351 assert(PyString_CheckExact(operand1));
1352 CHECK_OBJECT(operand2);
1353 assert(PyString_CheckExact(operand2));
1355 PyStringObject *a = (PyStringObject *)operand1;
1356 PyStringObject *b = (PyStringObject *)operand2;
1359 if (operand1 == operand2) {
1368 Py_ssize_t len_a = Py_SIZE(operand1);
1369 Py_ssize_t len_b = Py_SIZE(operand2);
1371 Py_ssize_t min_len = (len_a < len_b) ? len_a : len_b;
1375 c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval);
1378 c = memcmp(a->ob_sval, b->ob_sval, min_len);
1385 c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0;
1391 bool result = c != 0;
1396#if PYTHON_VERSION < 0x300
1398nuitka_bool RICH_COMPARE_GE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
1400 if (Py_TYPE(operand1) == &PyString_Type) {
1401 return COMPARE_GE_CBOOL_STR_STR(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1404#if PYTHON_VERSION < 0x300
1405 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
1406 return NUITKA_BOOL_EXCEPTION;
1409 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
1410 return NUITKA_BOOL_EXCEPTION;
1414 PyTypeObject *type1 = Py_TYPE(operand1);
1416#if PYTHON_VERSION < 0x300
1418 if (type1 == &PyString_Type && !0) {
1420 richcmpfunc frich = PyString_Type.tp_richcompare;
1422 if (frich != NULL) {
1423 PyObject *result = (*frich)(operand1, operand2, Py_GE);
1425 if (result != Py_NotImplemented) {
1426 Py_LeaveRecursiveCall();
1428 if (unlikely(result == NULL)) {
1429 return NUITKA_BOOL_EXCEPTION;
1433 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1439 Py_DECREF_IMMORTAL(result);
1443 cmpfunc fcmp = NULL;
1446 int c = (*fcmp)(operand1, operand2);
1447 c = adjust_tp_compare(c);
1449 Py_LeaveRecursiveCall();
1452 return NUITKA_BOOL_EXCEPTION;
1475 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
1479 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1488 if (type1 != &PyString_Type && 0) {
1489 f = PyString_Type.tp_richcompare;
1492 PyObject *result = (*f)(operand2, operand1, Py_LE);
1494 if (result != Py_NotImplemented) {
1495 Py_LeaveRecursiveCall();
1497 if (unlikely(result == NULL)) {
1498 return NUITKA_BOOL_EXCEPTION;
1502 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1508 Py_DECREF_IMMORTAL(result);
1512 f = TP_RICHCOMPARE(type1);
1514 PyObject *result = (*f)(operand1, operand2, Py_GE);
1516 if (result != Py_NotImplemented) {
1517 Py_LeaveRecursiveCall();
1519 if (unlikely(result == NULL)) {
1520 return NUITKA_BOOL_EXCEPTION;
1524 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1530 Py_DECREF_IMMORTAL(result);
1533 f = PyString_Type.tp_richcompare;
1535 PyObject *result = (*f)(operand2, operand1, Py_LE);
1537 if (result != Py_NotImplemented) {
1538 Py_LeaveRecursiveCall();
1540 if (unlikely(result == NULL)) {
1541 return NUITKA_BOOL_EXCEPTION;
1545 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1551 Py_DECREF_IMMORTAL(result);
1556 if (PyInstance_Check(operand1)) {
1557 cmpfunc fcmp = type1->tp_compare;
1558 c = (*fcmp)(operand1, operand2);
1560 cmpfunc fcmp = NULL;
1561 c = (*fcmp)(operand1, operand2);
1563 c = try_3way_compare(operand1, operand2);
1567 if (type1 == &PyString_Type) {
1568 Py_uintptr_t aa = (Py_uintptr_t)operand1;
1569 Py_uintptr_t bb = (Py_uintptr_t)operand2;
1571 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1572 }
else if (operand1 == Py_None) {
1575 }
else if (operand2 == Py_None) {
1578 }
else if (PyNumber_Check(operand1)) {
1581 if (PyNumber_Check(operand2)) {
1583 Py_uintptr_t aa = (Py_uintptr_t)type1;
1584 Py_uintptr_t bb = (Py_uintptr_t)&PyString_Type;
1586 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1590 }
else if (PyNumber_Check(operand2)) {
1594 int s = strcmp(type1->tp_name,
"str");
1602 Py_uintptr_t aa = (Py_uintptr_t)type1;
1603 Py_uintptr_t bb = (Py_uintptr_t)&PyString_Type;
1605 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1610 Py_LeaveRecursiveCall();
1612 if (unlikely(c <= -2)) {
1613 return NUITKA_BOOL_EXCEPTION;
1638 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1642 bool checked_reverse_op =
false;
1645 if (type1 != &PyString_Type && Nuitka_Type_IsSubtype(&PyString_Type, type1)) {
1646 f = PyString_Type.tp_richcompare;
1649 checked_reverse_op =
true;
1651 PyObject *result = (*f)(operand2, operand1, Py_LE);
1653 if (result != Py_NotImplemented) {
1654 Py_LeaveRecursiveCall();
1656 if (unlikely(result == NULL)) {
1657 return NUITKA_BOOL_EXCEPTION;
1661 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1667 Py_DECREF_IMMORTAL(result);
1671 f = TP_RICHCOMPARE(type1);
1674 PyObject *result = (*f)(operand1, operand2, Py_GE);
1676 if (result != Py_NotImplemented) {
1677 Py_LeaveRecursiveCall();
1679 if (unlikely(result == NULL)) {
1680 return NUITKA_BOOL_EXCEPTION;
1684 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1690 Py_DECREF_IMMORTAL(result);
1693 if (checked_reverse_op ==
false) {
1694 f = PyString_Type.tp_richcompare;
1697 PyObject *result = (*f)(operand2, operand1, Py_LE);
1699 if (result != Py_NotImplemented) {
1700 Py_LeaveRecursiveCall();
1702 if (unlikely(result == NULL)) {
1703 return NUITKA_BOOL_EXCEPTION;
1707 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1713 Py_DECREF_IMMORTAL(result);
1717 Py_LeaveRecursiveCall();
1723 bool r = operand1 == operand2;
1724 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1729 bool r = operand1 != operand2;
1730 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1735#if PYTHON_VERSION < 0x360
1736 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= str()", type1->tp_name);
1738 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'str'", type1->tp_name);
1740 return NUITKA_BOOL_EXCEPTION;
1746#if PYTHON_VERSION < 0x300
1748nuitka_bool RICH_COMPARE_GE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *operand2) {
1750 if (&PyString_Type == Py_TYPE(operand2)) {
1751 return COMPARE_GE_CBOOL_STR_STR(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1754#if PYTHON_VERSION < 0x300
1755 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
1756 return NUITKA_BOOL_EXCEPTION;
1759 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
1760 return NUITKA_BOOL_EXCEPTION;
1764 PyTypeObject *type2 = Py_TYPE(operand2);
1766#if PYTHON_VERSION < 0x300
1768 if (&PyString_Type == type2 && !0) {
1770 richcmpfunc frich = PyString_Type.tp_richcompare;
1772 if (frich != NULL) {
1773 PyObject *result = (*frich)(operand1, operand2, Py_GE);
1775 if (result != Py_NotImplemented) {
1776 Py_LeaveRecursiveCall();
1778 if (unlikely(result == NULL)) {
1779 return NUITKA_BOOL_EXCEPTION;
1783 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1789 Py_DECREF_IMMORTAL(result);
1793 cmpfunc fcmp = NULL;
1796 int c = (*fcmp)(operand1, operand2);
1797 c = adjust_tp_compare(c);
1799 Py_LeaveRecursiveCall();
1802 return NUITKA_BOOL_EXCEPTION;
1825 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
1829 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1838 if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1839 f = TP_RICHCOMPARE(type2);
1842 PyObject *result = (*f)(operand2, operand1, Py_LE);
1844 if (result != Py_NotImplemented) {
1845 Py_LeaveRecursiveCall();
1847 if (unlikely(result == NULL)) {
1848 return NUITKA_BOOL_EXCEPTION;
1852 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1858 Py_DECREF_IMMORTAL(result);
1862 f = PyString_Type.tp_richcompare;
1864 PyObject *result = (*f)(operand1, operand2, Py_GE);
1866 if (result != Py_NotImplemented) {
1867 Py_LeaveRecursiveCall();
1869 if (unlikely(result == NULL)) {
1870 return NUITKA_BOOL_EXCEPTION;
1874 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1880 Py_DECREF_IMMORTAL(result);
1883 f = TP_RICHCOMPARE(type2);
1885 PyObject *result = (*f)(operand2, operand1, Py_LE);
1887 if (result != Py_NotImplemented) {
1888 Py_LeaveRecursiveCall();
1890 if (unlikely(result == NULL)) {
1891 return NUITKA_BOOL_EXCEPTION;
1895 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1901 Py_DECREF_IMMORTAL(result);
1907 cmpfunc fcmp = NULL;
1908 c = (*fcmp)(operand1, operand2);
1909 }
else if (PyInstance_Check(operand2)) {
1910 cmpfunc fcmp = type2->tp_compare;
1911 c = (*fcmp)(operand1, operand2);
1913 c = try_3way_compare(operand1, operand2);
1917 if (&PyString_Type == type2) {
1918 Py_uintptr_t aa = (Py_uintptr_t)operand1;
1919 Py_uintptr_t bb = (Py_uintptr_t)operand2;
1921 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1922 }
else if (operand1 == Py_None) {
1925 }
else if (operand2 == Py_None) {
1928 }
else if (PyNumber_Check(operand1)) {
1931 if (PyNumber_Check(operand2)) {
1933 Py_uintptr_t aa = (Py_uintptr_t)&PyString_Type;
1934 Py_uintptr_t bb = (Py_uintptr_t)type2;
1936 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1940 }
else if (PyNumber_Check(operand2)) {
1944 int s = strcmp(
"str", type2->tp_name);
1952 Py_uintptr_t aa = (Py_uintptr_t)&PyString_Type;
1953 Py_uintptr_t bb = (Py_uintptr_t)type2;
1955 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1960 Py_LeaveRecursiveCall();
1962 if (unlikely(c <= -2)) {
1963 return NUITKA_BOOL_EXCEPTION;
1988 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1992 bool checked_reverse_op =
false;
1995 if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1996 f = TP_RICHCOMPARE(type2);
1999 checked_reverse_op =
true;
2001 PyObject *result = (*f)(operand2, operand1, Py_LE);
2003 if (result != Py_NotImplemented) {
2004 Py_LeaveRecursiveCall();
2006 if (unlikely(result == NULL)) {
2007 return NUITKA_BOOL_EXCEPTION;
2011 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2017 Py_DECREF_IMMORTAL(result);
2021 f = PyString_Type.tp_richcompare;
2024 PyObject *result = (*f)(operand1, operand2, Py_GE);
2026 if (result != Py_NotImplemented) {
2027 Py_LeaveRecursiveCall();
2029 if (unlikely(result == NULL)) {
2030 return NUITKA_BOOL_EXCEPTION;
2034 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2040 Py_DECREF_IMMORTAL(result);
2043 if (checked_reverse_op ==
false) {
2044 f = TP_RICHCOMPARE(type2);
2047 PyObject *result = (*f)(operand2, operand1, Py_LE);
2049 if (result != Py_NotImplemented) {
2050 Py_LeaveRecursiveCall();
2052 if (unlikely(result == NULL)) {
2053 return NUITKA_BOOL_EXCEPTION;
2057 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2063 Py_DECREF_IMMORTAL(result);
2067 Py_LeaveRecursiveCall();
2073 bool r = operand1 == operand2;
2074 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2079 bool r = operand1 != operand2;
2080 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2085#if PYTHON_VERSION < 0x360
2086 PyErr_Format(PyExc_TypeError,
"unorderable types: str() >= %s()", type2->tp_name);
2088 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'str' and '%s'", type2->tp_name);
2090 return NUITKA_BOOL_EXCEPTION;
2096static PyObject *COMPARE_GE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject *operand2) {
2097 CHECK_OBJECT(operand1);
2098 assert(PyUnicode_CheckExact(operand1));
2099 CHECK_OBJECT(operand2);
2100 assert(PyUnicode_CheckExact(operand2));
2102 PyUnicodeObject *a = (PyUnicodeObject *)operand1;
2103 PyUnicodeObject *b = (PyUnicodeObject *)operand2;
2106 if (operand1 == operand2) {
2110 PyObject *result = BOOL_FROM(r);
2111 Py_INCREF_IMMORTAL(result);
2115 PyObject *r = PyUnicode_RichCompare((PyObject *)a, (PyObject *)b, Py_GE);
2121PyObject *RICH_COMPARE_GE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *operand2) {
2123 if (Py_TYPE(operand1) == &PyUnicode_Type) {
2124 return COMPARE_GE_OBJECT_UNICODE_UNICODE(operand1, operand2);
2127#if PYTHON_VERSION < 0x300
2128 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
2132 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
2137 PyTypeObject *type1 = Py_TYPE(operand1);
2139#if PYTHON_VERSION < 0x300
2141 if (type1 == &PyUnicode_Type && !0) {
2143 richcmpfunc frich = PyUnicode_Type.tp_richcompare;
2145 if (frich != NULL) {
2146 PyObject *result = (*frich)(operand1, operand2, Py_GE);
2148 if (result != Py_NotImplemented) {
2149 Py_LeaveRecursiveCall();
2154 Py_DECREF_IMMORTAL(result);
2158 cmpfunc fcmp = PyUnicode_Type.tp_compare;
2161 int c = (*fcmp)(operand1, operand2);
2162 c = adjust_tp_compare(c);
2164 Py_LeaveRecursiveCall();
2190 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
2194 PyObject *result = BOOL_FROM(r);
2195 Py_INCREF_IMMORTAL(result);
2203 if (type1 != &PyUnicode_Type && 0) {
2204 f = PyUnicode_Type.tp_richcompare;
2207 PyObject *result = (*f)(operand2, operand1, Py_LE);
2209 if (result != Py_NotImplemented) {
2210 Py_LeaveRecursiveCall();
2215 Py_DECREF_IMMORTAL(result);
2219 f = TP_RICHCOMPARE(type1);
2221 PyObject *result = (*f)(operand1, operand2, Py_GE);
2223 if (result != Py_NotImplemented) {
2224 Py_LeaveRecursiveCall();
2229 Py_DECREF_IMMORTAL(result);
2232 f = PyUnicode_Type.tp_richcompare;
2234 PyObject *result = (*f)(operand2, operand1, Py_LE);
2236 if (result != Py_NotImplemented) {
2237 Py_LeaveRecursiveCall();
2242 Py_DECREF_IMMORTAL(result);
2247 if (PyInstance_Check(operand1)) {
2248 cmpfunc fcmp = type1->tp_compare;
2249 c = (*fcmp)(operand1, operand2);
2251 cmpfunc fcmp = PyUnicode_Type.tp_compare;
2252 c = (*fcmp)(operand1, operand2);
2254 c = try_3way_compare(operand1, operand2);
2258 if (type1 == &PyUnicode_Type) {
2259 Py_uintptr_t aa = (Py_uintptr_t)operand1;
2260 Py_uintptr_t bb = (Py_uintptr_t)operand2;
2262 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2263 }
else if (operand1 == Py_None) {
2266 }
else if (operand2 == Py_None) {
2269 }
else if (PyNumber_Check(operand1)) {
2272 if (PyNumber_Check(operand2)) {
2274 Py_uintptr_t aa = (Py_uintptr_t)type1;
2275 Py_uintptr_t bb = (Py_uintptr_t)&PyUnicode_Type;
2277 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2281 }
else if (PyNumber_Check(operand2)) {
2285 int s = strcmp(type1->tp_name, (PYTHON_VERSION < 0x300 ?
"unicode" :
"str"));
2293 Py_uintptr_t aa = (Py_uintptr_t)type1;
2294 Py_uintptr_t bb = (Py_uintptr_t)&PyUnicode_Type;
2296 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2301 Py_LeaveRecursiveCall();
2303 if (unlikely(c <= -2)) {
2329 PyObject *result = BOOL_FROM(r);
2330 Py_INCREF_IMMORTAL(result);
2333 bool checked_reverse_op =
false;
2336 if (type1 != &PyUnicode_Type && Nuitka_Type_IsSubtype(&PyUnicode_Type, type1)) {
2337 f = PyUnicode_Type.tp_richcompare;
2340 checked_reverse_op =
true;
2342 PyObject *result = (*f)(operand2, operand1, Py_LE);
2344 if (result != Py_NotImplemented) {
2345 Py_LeaveRecursiveCall();
2350 Py_DECREF_IMMORTAL(result);
2354 f = TP_RICHCOMPARE(type1);
2357 PyObject *result = (*f)(operand1, operand2, Py_GE);
2359 if (result != Py_NotImplemented) {
2360 Py_LeaveRecursiveCall();
2365 Py_DECREF_IMMORTAL(result);
2368 if (checked_reverse_op ==
false) {
2369 f = PyUnicode_Type.tp_richcompare;
2372 PyObject *result = (*f)(operand2, operand1, Py_LE);
2374 if (result != Py_NotImplemented) {
2375 Py_LeaveRecursiveCall();
2380 Py_DECREF_IMMORTAL(result);
2384 Py_LeaveRecursiveCall();
2390 bool r = operand1 == operand2;
2391 PyObject *result = BOOL_FROM(r);
2392 Py_INCREF_IMMORTAL(result);
2396 bool r = operand1 != operand2;
2397 PyObject *result = BOOL_FROM(r);
2398 Py_INCREF_IMMORTAL(result);
2402#if PYTHON_VERSION < 0x300
2403 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= unicode()", type1->tp_name);
2404#elif PYTHON_VERSION < 0x360
2405 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= str()", type1->tp_name);
2407 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'str'", type1->tp_name);
2415PyObject *RICH_COMPARE_GE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *operand2) {
2417 if (&PyUnicode_Type == Py_TYPE(operand2)) {
2418 return COMPARE_GE_OBJECT_UNICODE_UNICODE(operand1, operand2);
2421#if PYTHON_VERSION < 0x300
2422 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
2426 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
2431 PyTypeObject *type2 = Py_TYPE(operand2);
2433#if PYTHON_VERSION < 0x300
2435 if (&PyUnicode_Type == type2 && !0) {
2437 richcmpfunc frich = PyUnicode_Type.tp_richcompare;
2439 if (frich != NULL) {
2440 PyObject *result = (*frich)(operand1, operand2, Py_GE);
2442 if (result != Py_NotImplemented) {
2443 Py_LeaveRecursiveCall();
2448 Py_DECREF_IMMORTAL(result);
2452 cmpfunc fcmp = PyUnicode_Type.tp_compare;
2455 int c = (*fcmp)(operand1, operand2);
2456 c = adjust_tp_compare(c);
2458 Py_LeaveRecursiveCall();
2484 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
2488 PyObject *result = BOOL_FROM(r);
2489 Py_INCREF_IMMORTAL(result);
2497 if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2498 f = TP_RICHCOMPARE(type2);
2501 PyObject *result = (*f)(operand2, operand1, Py_LE);
2503 if (result != Py_NotImplemented) {
2504 Py_LeaveRecursiveCall();
2509 Py_DECREF_IMMORTAL(result);
2513 f = PyUnicode_Type.tp_richcompare;
2515 PyObject *result = (*f)(operand1, operand2, Py_GE);
2517 if (result != Py_NotImplemented) {
2518 Py_LeaveRecursiveCall();
2523 Py_DECREF_IMMORTAL(result);
2526 f = TP_RICHCOMPARE(type2);
2528 PyObject *result = (*f)(operand2, operand1, Py_LE);
2530 if (result != Py_NotImplemented) {
2531 Py_LeaveRecursiveCall();
2536 Py_DECREF_IMMORTAL(result);
2542 cmpfunc fcmp = PyUnicode_Type.tp_compare;
2543 c = (*fcmp)(operand1, operand2);
2544 }
else if (PyInstance_Check(operand2)) {
2545 cmpfunc fcmp = type2->tp_compare;
2546 c = (*fcmp)(operand1, operand2);
2548 c = try_3way_compare(operand1, operand2);
2552 if (&PyUnicode_Type == type2) {
2553 Py_uintptr_t aa = (Py_uintptr_t)operand1;
2554 Py_uintptr_t bb = (Py_uintptr_t)operand2;
2556 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2557 }
else if (operand1 == Py_None) {
2560 }
else if (operand2 == Py_None) {
2563 }
else if (PyNumber_Check(operand1)) {
2566 if (PyNumber_Check(operand2)) {
2568 Py_uintptr_t aa = (Py_uintptr_t)&PyUnicode_Type;
2569 Py_uintptr_t bb = (Py_uintptr_t)type2;
2571 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2575 }
else if (PyNumber_Check(operand2)) {
2579 int s = strcmp((PYTHON_VERSION < 0x300 ?
"unicode" :
"str"), type2->tp_name);
2587 Py_uintptr_t aa = (Py_uintptr_t)&PyUnicode_Type;
2588 Py_uintptr_t bb = (Py_uintptr_t)type2;
2590 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2595 Py_LeaveRecursiveCall();
2597 if (unlikely(c <= -2)) {
2623 PyObject *result = BOOL_FROM(r);
2624 Py_INCREF_IMMORTAL(result);
2627 bool checked_reverse_op =
false;
2630 if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2631 f = TP_RICHCOMPARE(type2);
2634 checked_reverse_op =
true;
2636 PyObject *result = (*f)(operand2, operand1, Py_LE);
2638 if (result != Py_NotImplemented) {
2639 Py_LeaveRecursiveCall();
2644 Py_DECREF_IMMORTAL(result);
2648 f = PyUnicode_Type.tp_richcompare;
2651 PyObject *result = (*f)(operand1, operand2, Py_GE);
2653 if (result != Py_NotImplemented) {
2654 Py_LeaveRecursiveCall();
2659 Py_DECREF_IMMORTAL(result);
2662 if (checked_reverse_op ==
false) {
2663 f = TP_RICHCOMPARE(type2);
2666 PyObject *result = (*f)(operand2, operand1, Py_LE);
2668 if (result != Py_NotImplemented) {
2669 Py_LeaveRecursiveCall();
2674 Py_DECREF_IMMORTAL(result);
2678 Py_LeaveRecursiveCall();
2684 bool r = operand1 == operand2;
2685 PyObject *result = BOOL_FROM(r);
2686 Py_INCREF_IMMORTAL(result);
2690 bool r = operand1 != operand2;
2691 PyObject *result = BOOL_FROM(r);
2692 Py_INCREF_IMMORTAL(result);
2696#if PYTHON_VERSION < 0x300
2697 PyErr_Format(PyExc_TypeError,
"unorderable types: unicode() >= %s()", type2->tp_name);
2698#elif PYTHON_VERSION < 0x360
2699 PyErr_Format(PyExc_TypeError,
"unorderable types: str() >= %s()", type2->tp_name);
2701 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'str' and '%s'", type2->tp_name);
2708static bool COMPARE_GE_CBOOL_UNICODE_UNICODE(PyObject *operand1, PyObject *operand2) {
2709 CHECK_OBJECT(operand1);
2710 assert(PyUnicode_CheckExact(operand1));
2711 CHECK_OBJECT(operand2);
2712 assert(PyUnicode_CheckExact(operand2));
2714 PyUnicodeObject *a = (PyUnicodeObject *)operand1;
2715 PyUnicodeObject *b = (PyUnicodeObject *)operand2;
2718 if (operand1 == operand2) {
2727 PyObject *r = PyUnicode_RichCompare((PyObject *)a, (PyObject *)b, Py_GE);
2731 bool result = r == Py_True;
2732 Py_DECREF_IMMORTAL(r);
2737nuitka_bool RICH_COMPARE_GE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *operand2) {
2739 if (Py_TYPE(operand1) == &PyUnicode_Type) {
2740 return COMPARE_GE_CBOOL_UNICODE_UNICODE(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2743#if PYTHON_VERSION < 0x300
2744 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
2745 return NUITKA_BOOL_EXCEPTION;
2748 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
2749 return NUITKA_BOOL_EXCEPTION;
2753 PyTypeObject *type1 = Py_TYPE(operand1);
2755#if PYTHON_VERSION < 0x300
2757 if (type1 == &PyUnicode_Type && !0) {
2759 richcmpfunc frich = PyUnicode_Type.tp_richcompare;
2761 if (frich != NULL) {
2762 PyObject *result = (*frich)(operand1, operand2, Py_GE);
2764 if (result != Py_NotImplemented) {
2765 Py_LeaveRecursiveCall();
2767 if (unlikely(result == NULL)) {
2768 return NUITKA_BOOL_EXCEPTION;
2772 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2778 Py_DECREF_IMMORTAL(result);
2782 cmpfunc fcmp = PyUnicode_Type.tp_compare;
2785 int c = (*fcmp)(operand1, operand2);
2786 c = adjust_tp_compare(c);
2788 Py_LeaveRecursiveCall();
2791 return NUITKA_BOOL_EXCEPTION;
2814 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
2818 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2827 if (type1 != &PyUnicode_Type && 0) {
2828 f = PyUnicode_Type.tp_richcompare;
2831 PyObject *result = (*f)(operand2, operand1, Py_LE);
2833 if (result != Py_NotImplemented) {
2834 Py_LeaveRecursiveCall();
2836 if (unlikely(result == NULL)) {
2837 return NUITKA_BOOL_EXCEPTION;
2841 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2847 Py_DECREF_IMMORTAL(result);
2851 f = TP_RICHCOMPARE(type1);
2853 PyObject *result = (*f)(operand1, operand2, Py_GE);
2855 if (result != Py_NotImplemented) {
2856 Py_LeaveRecursiveCall();
2858 if (unlikely(result == NULL)) {
2859 return NUITKA_BOOL_EXCEPTION;
2863 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2869 Py_DECREF_IMMORTAL(result);
2872 f = PyUnicode_Type.tp_richcompare;
2874 PyObject *result = (*f)(operand2, operand1, Py_LE);
2876 if (result != Py_NotImplemented) {
2877 Py_LeaveRecursiveCall();
2879 if (unlikely(result == NULL)) {
2880 return NUITKA_BOOL_EXCEPTION;
2884 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2890 Py_DECREF_IMMORTAL(result);
2895 if (PyInstance_Check(operand1)) {
2896 cmpfunc fcmp = type1->tp_compare;
2897 c = (*fcmp)(operand1, operand2);
2899 cmpfunc fcmp = PyUnicode_Type.tp_compare;
2900 c = (*fcmp)(operand1, operand2);
2902 c = try_3way_compare(operand1, operand2);
2906 if (type1 == &PyUnicode_Type) {
2907 Py_uintptr_t aa = (Py_uintptr_t)operand1;
2908 Py_uintptr_t bb = (Py_uintptr_t)operand2;
2910 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2911 }
else if (operand1 == Py_None) {
2914 }
else if (operand2 == Py_None) {
2917 }
else if (PyNumber_Check(operand1)) {
2920 if (PyNumber_Check(operand2)) {
2922 Py_uintptr_t aa = (Py_uintptr_t)type1;
2923 Py_uintptr_t bb = (Py_uintptr_t)&PyUnicode_Type;
2925 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2929 }
else if (PyNumber_Check(operand2)) {
2933 int s = strcmp(type1->tp_name, (PYTHON_VERSION < 0x300 ?
"unicode" :
"str"));
2941 Py_uintptr_t aa = (Py_uintptr_t)type1;
2942 Py_uintptr_t bb = (Py_uintptr_t)&PyUnicode_Type;
2944 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2949 Py_LeaveRecursiveCall();
2951 if (unlikely(c <= -2)) {
2952 return NUITKA_BOOL_EXCEPTION;
2977 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2981 bool checked_reverse_op =
false;
2984 if (type1 != &PyUnicode_Type && Nuitka_Type_IsSubtype(&PyUnicode_Type, type1)) {
2985 f = PyUnicode_Type.tp_richcompare;
2988 checked_reverse_op =
true;
2990 PyObject *result = (*f)(operand2, operand1, Py_LE);
2992 if (result != Py_NotImplemented) {
2993 Py_LeaveRecursiveCall();
2995 if (unlikely(result == NULL)) {
2996 return NUITKA_BOOL_EXCEPTION;
3000 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3006 Py_DECREF_IMMORTAL(result);
3010 f = TP_RICHCOMPARE(type1);
3013 PyObject *result = (*f)(operand1, operand2, Py_GE);
3015 if (result != Py_NotImplemented) {
3016 Py_LeaveRecursiveCall();
3018 if (unlikely(result == NULL)) {
3019 return NUITKA_BOOL_EXCEPTION;
3023 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3029 Py_DECREF_IMMORTAL(result);
3032 if (checked_reverse_op ==
false) {
3033 f = PyUnicode_Type.tp_richcompare;
3036 PyObject *result = (*f)(operand2, operand1, Py_LE);
3038 if (result != Py_NotImplemented) {
3039 Py_LeaveRecursiveCall();
3041 if (unlikely(result == NULL)) {
3042 return NUITKA_BOOL_EXCEPTION;
3046 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3052 Py_DECREF_IMMORTAL(result);
3056 Py_LeaveRecursiveCall();
3062 bool r = operand1 == operand2;
3063 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3068 bool r = operand1 != operand2;
3069 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3074#if PYTHON_VERSION < 0x300
3075 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= unicode()", type1->tp_name);
3076#elif PYTHON_VERSION < 0x360
3077 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= str()", type1->tp_name);
3079 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'str'", type1->tp_name);
3081 return NUITKA_BOOL_EXCEPTION;
3087nuitka_bool RICH_COMPARE_GE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *operand2) {
3089 if (&PyUnicode_Type == Py_TYPE(operand2)) {
3090 return COMPARE_GE_CBOOL_UNICODE_UNICODE(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3093#if PYTHON_VERSION < 0x300
3094 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
3095 return NUITKA_BOOL_EXCEPTION;
3098 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
3099 return NUITKA_BOOL_EXCEPTION;
3103 PyTypeObject *type2 = Py_TYPE(operand2);
3105#if PYTHON_VERSION < 0x300
3107 if (&PyUnicode_Type == type2 && !0) {
3109 richcmpfunc frich = PyUnicode_Type.tp_richcompare;
3111 if (frich != NULL) {
3112 PyObject *result = (*frich)(operand1, operand2, Py_GE);
3114 if (result != Py_NotImplemented) {
3115 Py_LeaveRecursiveCall();
3117 if (unlikely(result == NULL)) {
3118 return NUITKA_BOOL_EXCEPTION;
3122 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3128 Py_DECREF_IMMORTAL(result);
3132 cmpfunc fcmp = PyUnicode_Type.tp_compare;
3135 int c = (*fcmp)(operand1, operand2);
3136 c = adjust_tp_compare(c);
3138 Py_LeaveRecursiveCall();
3141 return NUITKA_BOOL_EXCEPTION;
3164 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
3168 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3177 if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3178 f = TP_RICHCOMPARE(type2);
3181 PyObject *result = (*f)(operand2, operand1, Py_LE);
3183 if (result != Py_NotImplemented) {
3184 Py_LeaveRecursiveCall();
3186 if (unlikely(result == NULL)) {
3187 return NUITKA_BOOL_EXCEPTION;
3191 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3197 Py_DECREF_IMMORTAL(result);
3201 f = PyUnicode_Type.tp_richcompare;
3203 PyObject *result = (*f)(operand1, operand2, Py_GE);
3205 if (result != Py_NotImplemented) {
3206 Py_LeaveRecursiveCall();
3208 if (unlikely(result == NULL)) {
3209 return NUITKA_BOOL_EXCEPTION;
3213 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3219 Py_DECREF_IMMORTAL(result);
3222 f = TP_RICHCOMPARE(type2);
3224 PyObject *result = (*f)(operand2, operand1, Py_LE);
3226 if (result != Py_NotImplemented) {
3227 Py_LeaveRecursiveCall();
3229 if (unlikely(result == NULL)) {
3230 return NUITKA_BOOL_EXCEPTION;
3234 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3240 Py_DECREF_IMMORTAL(result);
3246 cmpfunc fcmp = PyUnicode_Type.tp_compare;
3247 c = (*fcmp)(operand1, operand2);
3248 }
else if (PyInstance_Check(operand2)) {
3249 cmpfunc fcmp = type2->tp_compare;
3250 c = (*fcmp)(operand1, operand2);
3252 c = try_3way_compare(operand1, operand2);
3256 if (&PyUnicode_Type == type2) {
3257 Py_uintptr_t aa = (Py_uintptr_t)operand1;
3258 Py_uintptr_t bb = (Py_uintptr_t)operand2;
3260 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3261 }
else if (operand1 == Py_None) {
3264 }
else if (operand2 == Py_None) {
3267 }
else if (PyNumber_Check(operand1)) {
3270 if (PyNumber_Check(operand2)) {
3272 Py_uintptr_t aa = (Py_uintptr_t)&PyUnicode_Type;
3273 Py_uintptr_t bb = (Py_uintptr_t)type2;
3275 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3279 }
else if (PyNumber_Check(operand2)) {
3283 int s = strcmp((PYTHON_VERSION < 0x300 ?
"unicode" :
"str"), type2->tp_name);
3291 Py_uintptr_t aa = (Py_uintptr_t)&PyUnicode_Type;
3292 Py_uintptr_t bb = (Py_uintptr_t)type2;
3294 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3299 Py_LeaveRecursiveCall();
3301 if (unlikely(c <= -2)) {
3302 return NUITKA_BOOL_EXCEPTION;
3327 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3331 bool checked_reverse_op =
false;
3334 if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3335 f = TP_RICHCOMPARE(type2);
3338 checked_reverse_op =
true;
3340 PyObject *result = (*f)(operand2, operand1, Py_LE);
3342 if (result != Py_NotImplemented) {
3343 Py_LeaveRecursiveCall();
3345 if (unlikely(result == NULL)) {
3346 return NUITKA_BOOL_EXCEPTION;
3350 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3356 Py_DECREF_IMMORTAL(result);
3360 f = PyUnicode_Type.tp_richcompare;
3363 PyObject *result = (*f)(operand1, operand2, Py_GE);
3365 if (result != Py_NotImplemented) {
3366 Py_LeaveRecursiveCall();
3368 if (unlikely(result == NULL)) {
3369 return NUITKA_BOOL_EXCEPTION;
3373 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3379 Py_DECREF_IMMORTAL(result);
3382 if (checked_reverse_op ==
false) {
3383 f = TP_RICHCOMPARE(type2);
3386 PyObject *result = (*f)(operand2, operand1, Py_LE);
3388 if (result != Py_NotImplemented) {
3389 Py_LeaveRecursiveCall();
3391 if (unlikely(result == NULL)) {
3392 return NUITKA_BOOL_EXCEPTION;
3396 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3402 Py_DECREF_IMMORTAL(result);
3406 Py_LeaveRecursiveCall();
3412 bool r = operand1 == operand2;
3413 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3418 bool r = operand1 != operand2;
3419 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3424#if PYTHON_VERSION < 0x300
3425 PyErr_Format(PyExc_TypeError,
"unorderable types: unicode() >= %s()", type2->tp_name);
3426#elif PYTHON_VERSION < 0x360
3427 PyErr_Format(PyExc_TypeError,
"unorderable types: str() >= %s()", type2->tp_name);
3429 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'str' and '%s'", type2->tp_name);
3431 return NUITKA_BOOL_EXCEPTION;
3436#if PYTHON_VERSION >= 0x300
3437static PyObject *COMPARE_GE_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *operand2) {
3438 CHECK_OBJECT(operand1);
3439 assert(PyBytes_CheckExact(operand1));
3440 CHECK_OBJECT(operand2);
3441 assert(PyBytes_CheckExact(operand2));
3443 PyBytesObject *a = (PyBytesObject *)operand1;
3444 PyBytesObject *b = (PyBytesObject *)operand2;
3447 if (operand1 == operand2) {
3451 PyObject *result = BOOL_FROM(r);
3452 Py_INCREF_IMMORTAL(result);
3456 Py_ssize_t len_a = Py_SIZE(operand1);
3457 Py_ssize_t len_b = Py_SIZE(operand2);
3459 Py_ssize_t min_len = (len_a < len_b) ? len_a : len_b;
3463 c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval);
3466 c = memcmp(a->ob_sval, b->ob_sval, min_len);
3473 c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0;
3479 PyObject *result = BOOL_FROM(c != 0);
3480 Py_INCREF_IMMORTAL(result);
3484#if PYTHON_VERSION >= 0x300
3486PyObject *RICH_COMPARE_GE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
3488 if (Py_TYPE(operand1) == &PyBytes_Type) {
3489 return COMPARE_GE_OBJECT_BYTES_BYTES(operand1, operand2);
3492#if PYTHON_VERSION < 0x300
3493 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
3497 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
3502 PyTypeObject *type1 = Py_TYPE(operand1);
3504#if PYTHON_VERSION < 0x300
3506 if (type1 == &PyBytes_Type && !0) {
3508 richcmpfunc frich = PyBytes_Type.tp_richcompare;
3510 if (frich != NULL) {
3511 PyObject *result = (*frich)(operand1, operand2, Py_GE);
3513 if (result != Py_NotImplemented) {
3514 Py_LeaveRecursiveCall();
3519 Py_DECREF_IMMORTAL(result);
3523 cmpfunc fcmp = NULL;
3526 int c = (*fcmp)(operand1, operand2);
3527 c = adjust_tp_compare(c);
3529 Py_LeaveRecursiveCall();
3555 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
3559 PyObject *result = BOOL_FROM(r);
3560 Py_INCREF_IMMORTAL(result);
3568 if (type1 != &PyBytes_Type && 0) {
3569 f = PyBytes_Type.tp_richcompare;
3572 PyObject *result = (*f)(operand2, operand1, Py_LE);
3574 if (result != Py_NotImplemented) {
3575 Py_LeaveRecursiveCall();
3580 Py_DECREF_IMMORTAL(result);
3584 f = TP_RICHCOMPARE(type1);
3586 PyObject *result = (*f)(operand1, operand2, Py_GE);
3588 if (result != Py_NotImplemented) {
3589 Py_LeaveRecursiveCall();
3594 Py_DECREF_IMMORTAL(result);
3597 f = PyBytes_Type.tp_richcompare;
3599 PyObject *result = (*f)(operand2, operand1, Py_LE);
3601 if (result != Py_NotImplemented) {
3602 Py_LeaveRecursiveCall();
3607 Py_DECREF_IMMORTAL(result);
3612 if (PyInstance_Check(operand1)) {
3613 cmpfunc fcmp = type1->tp_compare;
3614 c = (*fcmp)(operand1, operand2);
3616 cmpfunc fcmp = NULL;
3617 c = (*fcmp)(operand1, operand2);
3619 c = try_3way_compare(operand1, operand2);
3623 if (type1 == &PyBytes_Type) {
3624 Py_uintptr_t aa = (Py_uintptr_t)operand1;
3625 Py_uintptr_t bb = (Py_uintptr_t)operand2;
3627 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3628 }
else if (operand1 == Py_None) {
3631 }
else if (operand2 == Py_None) {
3634 }
else if (PyNumber_Check(operand1)) {
3637 if (PyNumber_Check(operand2)) {
3639 Py_uintptr_t aa = (Py_uintptr_t)type1;
3640 Py_uintptr_t bb = (Py_uintptr_t)&PyBytes_Type;
3642 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3646 }
else if (PyNumber_Check(operand2)) {
3650 int s = strcmp(type1->tp_name,
"bytes");
3658 Py_uintptr_t aa = (Py_uintptr_t)type1;
3659 Py_uintptr_t bb = (Py_uintptr_t)&PyBytes_Type;
3661 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3666 Py_LeaveRecursiveCall();
3668 if (unlikely(c <= -2)) {
3694 PyObject *result = BOOL_FROM(r);
3695 Py_INCREF_IMMORTAL(result);
3698 bool checked_reverse_op =
false;
3701 if (type1 != &PyBytes_Type && Nuitka_Type_IsSubtype(&PyBytes_Type, type1)) {
3702 f = PyBytes_Type.tp_richcompare;
3705 checked_reverse_op =
true;
3707 PyObject *result = (*f)(operand2, operand1, Py_LE);
3709 if (result != Py_NotImplemented) {
3710 Py_LeaveRecursiveCall();
3715 Py_DECREF_IMMORTAL(result);
3719 f = TP_RICHCOMPARE(type1);
3722 PyObject *result = (*f)(operand1, operand2, Py_GE);
3724 if (result != Py_NotImplemented) {
3725 Py_LeaveRecursiveCall();
3730 Py_DECREF_IMMORTAL(result);
3733 if (checked_reverse_op ==
false) {
3734 f = PyBytes_Type.tp_richcompare;
3737 PyObject *result = (*f)(operand2, operand1, Py_LE);
3739 if (result != Py_NotImplemented) {
3740 Py_LeaveRecursiveCall();
3745 Py_DECREF_IMMORTAL(result);
3749 Py_LeaveRecursiveCall();
3755 bool r = operand1 == operand2;
3756 PyObject *result = BOOL_FROM(r);
3757 Py_INCREF_IMMORTAL(result);
3761 bool r = operand1 != operand2;
3762 PyObject *result = BOOL_FROM(r);
3763 Py_INCREF_IMMORTAL(result);
3767#if PYTHON_VERSION < 0x360
3768 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= bytes()", type1->tp_name);
3770 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'bytes'", type1->tp_name);
3778#if PYTHON_VERSION >= 0x300
3780PyObject *RICH_COMPARE_GE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *operand2) {
3782 if (&PyBytes_Type == Py_TYPE(operand2)) {
3783 return COMPARE_GE_OBJECT_BYTES_BYTES(operand1, operand2);
3786#if PYTHON_VERSION < 0x300
3787 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
3791 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
3796 PyTypeObject *type2 = Py_TYPE(operand2);
3798#if PYTHON_VERSION < 0x300
3800 if (&PyBytes_Type == type2 && !0) {
3802 richcmpfunc frich = PyBytes_Type.tp_richcompare;
3804 if (frich != NULL) {
3805 PyObject *result = (*frich)(operand1, operand2, Py_GE);
3807 if (result != Py_NotImplemented) {
3808 Py_LeaveRecursiveCall();
3813 Py_DECREF_IMMORTAL(result);
3817 cmpfunc fcmp = NULL;
3820 int c = (*fcmp)(operand1, operand2);
3821 c = adjust_tp_compare(c);
3823 Py_LeaveRecursiveCall();
3849 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
3853 PyObject *result = BOOL_FROM(r);
3854 Py_INCREF_IMMORTAL(result);
3862 if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
3863 f = TP_RICHCOMPARE(type2);
3866 PyObject *result = (*f)(operand2, operand1, Py_LE);
3868 if (result != Py_NotImplemented) {
3869 Py_LeaveRecursiveCall();
3874 Py_DECREF_IMMORTAL(result);
3878 f = PyBytes_Type.tp_richcompare;
3880 PyObject *result = (*f)(operand1, operand2, Py_GE);
3882 if (result != Py_NotImplemented) {
3883 Py_LeaveRecursiveCall();
3888 Py_DECREF_IMMORTAL(result);
3891 f = TP_RICHCOMPARE(type2);
3893 PyObject *result = (*f)(operand2, operand1, Py_LE);
3895 if (result != Py_NotImplemented) {
3896 Py_LeaveRecursiveCall();
3901 Py_DECREF_IMMORTAL(result);
3907 cmpfunc fcmp = NULL;
3908 c = (*fcmp)(operand1, operand2);
3909 }
else if (PyInstance_Check(operand2)) {
3910 cmpfunc fcmp = type2->tp_compare;
3911 c = (*fcmp)(operand1, operand2);
3913 c = try_3way_compare(operand1, operand2);
3917 if (&PyBytes_Type == type2) {
3918 Py_uintptr_t aa = (Py_uintptr_t)operand1;
3919 Py_uintptr_t bb = (Py_uintptr_t)operand2;
3921 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3922 }
else if (operand1 == Py_None) {
3925 }
else if (operand2 == Py_None) {
3928 }
else if (PyNumber_Check(operand1)) {
3931 if (PyNumber_Check(operand2)) {
3933 Py_uintptr_t aa = (Py_uintptr_t)&PyBytes_Type;
3934 Py_uintptr_t bb = (Py_uintptr_t)type2;
3936 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3940 }
else if (PyNumber_Check(operand2)) {
3944 int s = strcmp(
"bytes", type2->tp_name);
3952 Py_uintptr_t aa = (Py_uintptr_t)&PyBytes_Type;
3953 Py_uintptr_t bb = (Py_uintptr_t)type2;
3955 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3960 Py_LeaveRecursiveCall();
3962 if (unlikely(c <= -2)) {
3988 PyObject *result = BOOL_FROM(r);
3989 Py_INCREF_IMMORTAL(result);
3992 bool checked_reverse_op =
false;
3995 if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
3996 f = TP_RICHCOMPARE(type2);
3999 checked_reverse_op =
true;
4001 PyObject *result = (*f)(operand2, operand1, Py_LE);
4003 if (result != Py_NotImplemented) {
4004 Py_LeaveRecursiveCall();
4009 Py_DECREF_IMMORTAL(result);
4013 f = PyBytes_Type.tp_richcompare;
4016 PyObject *result = (*f)(operand1, operand2, Py_GE);
4018 if (result != Py_NotImplemented) {
4019 Py_LeaveRecursiveCall();
4024 Py_DECREF_IMMORTAL(result);
4027 if (checked_reverse_op ==
false) {
4028 f = TP_RICHCOMPARE(type2);
4031 PyObject *result = (*f)(operand2, operand1, Py_LE);
4033 if (result != Py_NotImplemented) {
4034 Py_LeaveRecursiveCall();
4039 Py_DECREF_IMMORTAL(result);
4043 Py_LeaveRecursiveCall();
4049 bool r = operand1 == operand2;
4050 PyObject *result = BOOL_FROM(r);
4051 Py_INCREF_IMMORTAL(result);
4055 bool r = operand1 != operand2;
4056 PyObject *result = BOOL_FROM(r);
4057 Py_INCREF_IMMORTAL(result);
4061#if PYTHON_VERSION < 0x360
4062 PyErr_Format(PyExc_TypeError,
"unorderable types: bytes() >= %s()", type2->tp_name);
4064 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'bytes' and '%s'", type2->tp_name);
4072#if PYTHON_VERSION >= 0x300
4073static bool COMPARE_GE_CBOOL_BYTES_BYTES(PyObject *operand1, PyObject *operand2) {
4074 CHECK_OBJECT(operand1);
4075 assert(PyBytes_CheckExact(operand1));
4076 CHECK_OBJECT(operand2);
4077 assert(PyBytes_CheckExact(operand2));
4079 PyBytesObject *a = (PyBytesObject *)operand1;
4080 PyBytesObject *b = (PyBytesObject *)operand2;
4083 if (operand1 == operand2) {
4092 Py_ssize_t len_a = Py_SIZE(operand1);
4093 Py_ssize_t len_b = Py_SIZE(operand2);
4095 Py_ssize_t min_len = (len_a < len_b) ? len_a : len_b;
4099 c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval);
4102 c = memcmp(a->ob_sval, b->ob_sval, min_len);
4109 c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0;
4115 bool result = c != 0;
4120#if PYTHON_VERSION >= 0x300
4122nuitka_bool RICH_COMPARE_GE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
4124 if (Py_TYPE(operand1) == &PyBytes_Type) {
4125 return COMPARE_GE_CBOOL_BYTES_BYTES(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4128#if PYTHON_VERSION < 0x300
4129 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
4130 return NUITKA_BOOL_EXCEPTION;
4133 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
4134 return NUITKA_BOOL_EXCEPTION;
4138 PyTypeObject *type1 = Py_TYPE(operand1);
4140#if PYTHON_VERSION < 0x300
4142 if (type1 == &PyBytes_Type && !0) {
4144 richcmpfunc frich = PyBytes_Type.tp_richcompare;
4146 if (frich != NULL) {
4147 PyObject *result = (*frich)(operand1, operand2, Py_GE);
4149 if (result != Py_NotImplemented) {
4150 Py_LeaveRecursiveCall();
4152 if (unlikely(result == NULL)) {
4153 return NUITKA_BOOL_EXCEPTION;
4157 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4163 Py_DECREF_IMMORTAL(result);
4167 cmpfunc fcmp = NULL;
4170 int c = (*fcmp)(operand1, operand2);
4171 c = adjust_tp_compare(c);
4173 Py_LeaveRecursiveCall();
4176 return NUITKA_BOOL_EXCEPTION;
4199 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
4203 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4212 if (type1 != &PyBytes_Type && 0) {
4213 f = PyBytes_Type.tp_richcompare;
4216 PyObject *result = (*f)(operand2, operand1, Py_LE);
4218 if (result != Py_NotImplemented) {
4219 Py_LeaveRecursiveCall();
4221 if (unlikely(result == NULL)) {
4222 return NUITKA_BOOL_EXCEPTION;
4226 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4232 Py_DECREF_IMMORTAL(result);
4236 f = TP_RICHCOMPARE(type1);
4238 PyObject *result = (*f)(operand1, operand2, Py_GE);
4240 if (result != Py_NotImplemented) {
4241 Py_LeaveRecursiveCall();
4243 if (unlikely(result == NULL)) {
4244 return NUITKA_BOOL_EXCEPTION;
4248 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4254 Py_DECREF_IMMORTAL(result);
4257 f = PyBytes_Type.tp_richcompare;
4259 PyObject *result = (*f)(operand2, operand1, Py_LE);
4261 if (result != Py_NotImplemented) {
4262 Py_LeaveRecursiveCall();
4264 if (unlikely(result == NULL)) {
4265 return NUITKA_BOOL_EXCEPTION;
4269 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4275 Py_DECREF_IMMORTAL(result);
4280 if (PyInstance_Check(operand1)) {
4281 cmpfunc fcmp = type1->tp_compare;
4282 c = (*fcmp)(operand1, operand2);
4284 cmpfunc fcmp = NULL;
4285 c = (*fcmp)(operand1, operand2);
4287 c = try_3way_compare(operand1, operand2);
4291 if (type1 == &PyBytes_Type) {
4292 Py_uintptr_t aa = (Py_uintptr_t)operand1;
4293 Py_uintptr_t bb = (Py_uintptr_t)operand2;
4295 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4296 }
else if (operand1 == Py_None) {
4299 }
else if (operand2 == Py_None) {
4302 }
else if (PyNumber_Check(operand1)) {
4305 if (PyNumber_Check(operand2)) {
4307 Py_uintptr_t aa = (Py_uintptr_t)type1;
4308 Py_uintptr_t bb = (Py_uintptr_t)&PyBytes_Type;
4310 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4314 }
else if (PyNumber_Check(operand2)) {
4318 int s = strcmp(type1->tp_name,
"bytes");
4326 Py_uintptr_t aa = (Py_uintptr_t)type1;
4327 Py_uintptr_t bb = (Py_uintptr_t)&PyBytes_Type;
4329 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4334 Py_LeaveRecursiveCall();
4336 if (unlikely(c <= -2)) {
4337 return NUITKA_BOOL_EXCEPTION;
4362 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4366 bool checked_reverse_op =
false;
4369 if (type1 != &PyBytes_Type && Nuitka_Type_IsSubtype(&PyBytes_Type, type1)) {
4370 f = PyBytes_Type.tp_richcompare;
4373 checked_reverse_op =
true;
4375 PyObject *result = (*f)(operand2, operand1, Py_LE);
4377 if (result != Py_NotImplemented) {
4378 Py_LeaveRecursiveCall();
4380 if (unlikely(result == NULL)) {
4381 return NUITKA_BOOL_EXCEPTION;
4385 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4391 Py_DECREF_IMMORTAL(result);
4395 f = TP_RICHCOMPARE(type1);
4398 PyObject *result = (*f)(operand1, operand2, Py_GE);
4400 if (result != Py_NotImplemented) {
4401 Py_LeaveRecursiveCall();
4403 if (unlikely(result == NULL)) {
4404 return NUITKA_BOOL_EXCEPTION;
4408 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4414 Py_DECREF_IMMORTAL(result);
4417 if (checked_reverse_op ==
false) {
4418 f = PyBytes_Type.tp_richcompare;
4421 PyObject *result = (*f)(operand2, operand1, Py_LE);
4423 if (result != Py_NotImplemented) {
4424 Py_LeaveRecursiveCall();
4426 if (unlikely(result == NULL)) {
4427 return NUITKA_BOOL_EXCEPTION;
4431 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4437 Py_DECREF_IMMORTAL(result);
4441 Py_LeaveRecursiveCall();
4447 bool r = operand1 == operand2;
4448 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4453 bool r = operand1 != operand2;
4454 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4459#if PYTHON_VERSION < 0x360
4460 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= bytes()", type1->tp_name);
4462 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'bytes'", type1->tp_name);
4464 return NUITKA_BOOL_EXCEPTION;
4470#if PYTHON_VERSION >= 0x300
4472nuitka_bool RICH_COMPARE_GE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *operand2) {
4474 if (&PyBytes_Type == Py_TYPE(operand2)) {
4475 return COMPARE_GE_CBOOL_BYTES_BYTES(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4478#if PYTHON_VERSION < 0x300
4479 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
4480 return NUITKA_BOOL_EXCEPTION;
4483 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
4484 return NUITKA_BOOL_EXCEPTION;
4488 PyTypeObject *type2 = Py_TYPE(operand2);
4490#if PYTHON_VERSION < 0x300
4492 if (&PyBytes_Type == type2 && !0) {
4494 richcmpfunc frich = PyBytes_Type.tp_richcompare;
4496 if (frich != NULL) {
4497 PyObject *result = (*frich)(operand1, operand2, Py_GE);
4499 if (result != Py_NotImplemented) {
4500 Py_LeaveRecursiveCall();
4502 if (unlikely(result == NULL)) {
4503 return NUITKA_BOOL_EXCEPTION;
4507 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4513 Py_DECREF_IMMORTAL(result);
4517 cmpfunc fcmp = NULL;
4520 int c = (*fcmp)(operand1, operand2);
4521 c = adjust_tp_compare(c);
4523 Py_LeaveRecursiveCall();
4526 return NUITKA_BOOL_EXCEPTION;
4549 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
4553 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4562 if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4563 f = TP_RICHCOMPARE(type2);
4566 PyObject *result = (*f)(operand2, operand1, Py_LE);
4568 if (result != Py_NotImplemented) {
4569 Py_LeaveRecursiveCall();
4571 if (unlikely(result == NULL)) {
4572 return NUITKA_BOOL_EXCEPTION;
4576 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4582 Py_DECREF_IMMORTAL(result);
4586 f = PyBytes_Type.tp_richcompare;
4588 PyObject *result = (*f)(operand1, operand2, Py_GE);
4590 if (result != Py_NotImplemented) {
4591 Py_LeaveRecursiveCall();
4593 if (unlikely(result == NULL)) {
4594 return NUITKA_BOOL_EXCEPTION;
4598 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4604 Py_DECREF_IMMORTAL(result);
4607 f = TP_RICHCOMPARE(type2);
4609 PyObject *result = (*f)(operand2, operand1, Py_LE);
4611 if (result != Py_NotImplemented) {
4612 Py_LeaveRecursiveCall();
4614 if (unlikely(result == NULL)) {
4615 return NUITKA_BOOL_EXCEPTION;
4619 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4625 Py_DECREF_IMMORTAL(result);
4631 cmpfunc fcmp = NULL;
4632 c = (*fcmp)(operand1, operand2);
4633 }
else if (PyInstance_Check(operand2)) {
4634 cmpfunc fcmp = type2->tp_compare;
4635 c = (*fcmp)(operand1, operand2);
4637 c = try_3way_compare(operand1, operand2);
4641 if (&PyBytes_Type == type2) {
4642 Py_uintptr_t aa = (Py_uintptr_t)operand1;
4643 Py_uintptr_t bb = (Py_uintptr_t)operand2;
4645 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4646 }
else if (operand1 == Py_None) {
4649 }
else if (operand2 == Py_None) {
4652 }
else if (PyNumber_Check(operand1)) {
4655 if (PyNumber_Check(operand2)) {
4657 Py_uintptr_t aa = (Py_uintptr_t)&PyBytes_Type;
4658 Py_uintptr_t bb = (Py_uintptr_t)type2;
4660 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4664 }
else if (PyNumber_Check(operand2)) {
4668 int s = strcmp(
"bytes", type2->tp_name);
4676 Py_uintptr_t aa = (Py_uintptr_t)&PyBytes_Type;
4677 Py_uintptr_t bb = (Py_uintptr_t)type2;
4679 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4684 Py_LeaveRecursiveCall();
4686 if (unlikely(c <= -2)) {
4687 return NUITKA_BOOL_EXCEPTION;
4712 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4716 bool checked_reverse_op =
false;
4719 if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4720 f = TP_RICHCOMPARE(type2);
4723 checked_reverse_op =
true;
4725 PyObject *result = (*f)(operand2, operand1, Py_LE);
4727 if (result != Py_NotImplemented) {
4728 Py_LeaveRecursiveCall();
4730 if (unlikely(result == NULL)) {
4731 return NUITKA_BOOL_EXCEPTION;
4735 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4741 Py_DECREF_IMMORTAL(result);
4745 f = PyBytes_Type.tp_richcompare;
4748 PyObject *result = (*f)(operand1, operand2, Py_GE);
4750 if (result != Py_NotImplemented) {
4751 Py_LeaveRecursiveCall();
4753 if (unlikely(result == NULL)) {
4754 return NUITKA_BOOL_EXCEPTION;
4758 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4764 Py_DECREF_IMMORTAL(result);
4767 if (checked_reverse_op ==
false) {
4768 f = TP_RICHCOMPARE(type2);
4771 PyObject *result = (*f)(operand2, operand1, Py_LE);
4773 if (result != Py_NotImplemented) {
4774 Py_LeaveRecursiveCall();
4776 if (unlikely(result == NULL)) {
4777 return NUITKA_BOOL_EXCEPTION;
4781 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4787 Py_DECREF_IMMORTAL(result);
4791 Py_LeaveRecursiveCall();
4797 bool r = operand1 == operand2;
4798 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4803 bool r = operand1 != operand2;
4804 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4809#if PYTHON_VERSION < 0x360
4810 PyErr_Format(PyExc_TypeError,
"unorderable types: bytes() >= %s()", type2->tp_name);
4812 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'bytes' and '%s'", type2->tp_name);
4814 return NUITKA_BOOL_EXCEPTION;
4820#if PYTHON_VERSION < 0x300
4822PyObject *RICH_COMPARE_GE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
4824 if (Py_TYPE(operand1) == &PyInt_Type) {
4825 return COMPARE_GE_OBJECT_INT_INT(operand1, operand2);
4828#if PYTHON_VERSION < 0x300
4829 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
4833 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
4838 PyTypeObject *type1 = Py_TYPE(operand1);
4840#if PYTHON_VERSION < 0x300
4842 if (type1 == &PyInt_Type && !0) {
4844 richcmpfunc frich = NULL;
4846 if (frich != NULL) {
4847 PyObject *result = (*frich)(operand1, operand2, Py_GE);
4849 if (result != Py_NotImplemented) {
4850 Py_LeaveRecursiveCall();
4855 Py_DECREF_IMMORTAL(result);
4859 cmpfunc fcmp = PyInt_Type.tp_compare;
4862 int c = (*fcmp)(operand1, operand2);
4863 c = adjust_tp_compare(c);
4865 Py_LeaveRecursiveCall();
4891 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
4895 PyObject *result = BOOL_FROM(r);
4896 Py_INCREF_IMMORTAL(result);
4904 if (type1 != &PyInt_Type && 0) {
4908 PyObject *result = (*f)(operand2, operand1, Py_LE);
4910 if (result != Py_NotImplemented) {
4911 Py_LeaveRecursiveCall();
4916 Py_DECREF_IMMORTAL(result);
4920 f = TP_RICHCOMPARE(type1);
4922 PyObject *result = (*f)(operand1, operand2, Py_GE);
4924 if (result != Py_NotImplemented) {
4925 Py_LeaveRecursiveCall();
4930 Py_DECREF_IMMORTAL(result);
4935 PyObject *result = (*f)(operand2, operand1, Py_LE);
4937 if (result != Py_NotImplemented) {
4938 Py_LeaveRecursiveCall();
4943 Py_DECREF_IMMORTAL(result);
4948 if (PyInstance_Check(operand1)) {
4949 cmpfunc fcmp = type1->tp_compare;
4950 c = (*fcmp)(operand1, operand2);
4952 cmpfunc fcmp = PyInt_Type.tp_compare;
4953 c = (*fcmp)(operand1, operand2);
4955 c = try_3way_compare(operand1, operand2);
4959 if (type1 == &PyInt_Type) {
4960 Py_uintptr_t aa = (Py_uintptr_t)operand1;
4961 Py_uintptr_t bb = (Py_uintptr_t)operand2;
4963 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4964 }
else if (operand1 == Py_None) {
4967 }
else if (operand2 == Py_None) {
4970 }
else if (PyNumber_Check(operand1)) {
4973 if (PyNumber_Check(operand2)) {
4975 Py_uintptr_t aa = (Py_uintptr_t)type1;
4976 Py_uintptr_t bb = (Py_uintptr_t)&PyInt_Type;
4978 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4982 }
else if (PyNumber_Check(operand2)) {
4986 int s = strcmp(type1->tp_name,
"int");
4994 Py_uintptr_t aa = (Py_uintptr_t)type1;
4995 Py_uintptr_t bb = (Py_uintptr_t)&PyInt_Type;
4997 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5002 Py_LeaveRecursiveCall();
5004 if (unlikely(c <= -2)) {
5030 PyObject *result = BOOL_FROM(r);
5031 Py_INCREF_IMMORTAL(result);
5034 bool checked_reverse_op =
false;
5037 if (type1 != &PyInt_Type && Nuitka_Type_IsSubtype(&PyInt_Type, type1)) {
5041 checked_reverse_op =
true;
5043 PyObject *result = (*f)(operand2, operand1, Py_LE);
5045 if (result != Py_NotImplemented) {
5046 Py_LeaveRecursiveCall();
5051 Py_DECREF_IMMORTAL(result);
5055 f = TP_RICHCOMPARE(type1);
5058 PyObject *result = (*f)(operand1, operand2, Py_GE);
5060 if (result != Py_NotImplemented) {
5061 Py_LeaveRecursiveCall();
5066 Py_DECREF_IMMORTAL(result);
5069 if (checked_reverse_op ==
false) {
5073 PyObject *result = (*f)(operand2, operand1, Py_LE);
5075 if (result != Py_NotImplemented) {
5076 Py_LeaveRecursiveCall();
5081 Py_DECREF_IMMORTAL(result);
5085 Py_LeaveRecursiveCall();
5091 bool r = operand1 == operand2;
5092 PyObject *result = BOOL_FROM(r);
5093 Py_INCREF_IMMORTAL(result);
5097 bool r = operand1 != operand2;
5098 PyObject *result = BOOL_FROM(r);
5099 Py_INCREF_IMMORTAL(result);
5103#if PYTHON_VERSION < 0x360
5104 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= int()", type1->tp_name);
5106 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'int'", type1->tp_name);
5114#if PYTHON_VERSION < 0x300
5116PyObject *RICH_COMPARE_GE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
5118 if (&PyInt_Type == Py_TYPE(operand2)) {
5119 return COMPARE_GE_OBJECT_INT_INT(operand1, operand2);
5122#if PYTHON_VERSION < 0x300
5123 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
5127 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
5132 PyTypeObject *type2 = Py_TYPE(operand2);
5134#if PYTHON_VERSION < 0x300
5136 if (&PyInt_Type == type2 && !0) {
5138 richcmpfunc frich = NULL;
5140 if (frich != NULL) {
5141 PyObject *result = (*frich)(operand1, operand2, Py_GE);
5143 if (result != Py_NotImplemented) {
5144 Py_LeaveRecursiveCall();
5149 Py_DECREF_IMMORTAL(result);
5153 cmpfunc fcmp = PyInt_Type.tp_compare;
5156 int c = (*fcmp)(operand1, operand2);
5157 c = adjust_tp_compare(c);
5159 Py_LeaveRecursiveCall();
5185 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
5189 PyObject *result = BOOL_FROM(r);
5190 Py_INCREF_IMMORTAL(result);
5198 if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5199 f = TP_RICHCOMPARE(type2);
5202 PyObject *result = (*f)(operand2, operand1, Py_LE);
5204 if (result != Py_NotImplemented) {
5205 Py_LeaveRecursiveCall();
5210 Py_DECREF_IMMORTAL(result);
5216 PyObject *result = (*f)(operand1, operand2, Py_GE);
5218 if (result != Py_NotImplemented) {
5219 Py_LeaveRecursiveCall();
5224 Py_DECREF_IMMORTAL(result);
5227 f = TP_RICHCOMPARE(type2);
5229 PyObject *result = (*f)(operand2, operand1, Py_LE);
5231 if (result != Py_NotImplemented) {
5232 Py_LeaveRecursiveCall();
5237 Py_DECREF_IMMORTAL(result);
5243 cmpfunc fcmp = PyInt_Type.tp_compare;
5244 c = (*fcmp)(operand1, operand2);
5245 }
else if (PyInstance_Check(operand2)) {
5246 cmpfunc fcmp = type2->tp_compare;
5247 c = (*fcmp)(operand1, operand2);
5249 c = try_3way_compare(operand1, operand2);
5253 if (&PyInt_Type == type2) {
5254 Py_uintptr_t aa = (Py_uintptr_t)operand1;
5255 Py_uintptr_t bb = (Py_uintptr_t)operand2;
5257 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5258 }
else if (operand1 == Py_None) {
5261 }
else if (operand2 == Py_None) {
5264 }
else if (PyNumber_Check(operand1)) {
5267 if (PyNumber_Check(operand2)) {
5269 Py_uintptr_t aa = (Py_uintptr_t)&PyInt_Type;
5270 Py_uintptr_t bb = (Py_uintptr_t)type2;
5272 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5276 }
else if (PyNumber_Check(operand2)) {
5280 int s = strcmp(
"int", type2->tp_name);
5288 Py_uintptr_t aa = (Py_uintptr_t)&PyInt_Type;
5289 Py_uintptr_t bb = (Py_uintptr_t)type2;
5291 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5296 Py_LeaveRecursiveCall();
5298 if (unlikely(c <= -2)) {
5324 PyObject *result = BOOL_FROM(r);
5325 Py_INCREF_IMMORTAL(result);
5328 bool checked_reverse_op =
false;
5331 if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5332 f = TP_RICHCOMPARE(type2);
5335 checked_reverse_op =
true;
5337 PyObject *result = (*f)(operand2, operand1, Py_LE);
5339 if (result != Py_NotImplemented) {
5340 Py_LeaveRecursiveCall();
5345 Py_DECREF_IMMORTAL(result);
5352 PyObject *result = (*f)(operand1, operand2, Py_GE);
5354 if (result != Py_NotImplemented) {
5355 Py_LeaveRecursiveCall();
5360 Py_DECREF_IMMORTAL(result);
5363 if (checked_reverse_op ==
false) {
5364 f = TP_RICHCOMPARE(type2);
5367 PyObject *result = (*f)(operand2, operand1, Py_LE);
5369 if (result != Py_NotImplemented) {
5370 Py_LeaveRecursiveCall();
5375 Py_DECREF_IMMORTAL(result);
5379 Py_LeaveRecursiveCall();
5385 bool r = operand1 == operand2;
5386 PyObject *result = BOOL_FROM(r);
5387 Py_INCREF_IMMORTAL(result);
5391 bool r = operand1 != operand2;
5392 PyObject *result = BOOL_FROM(r);
5393 Py_INCREF_IMMORTAL(result);
5397#if PYTHON_VERSION < 0x360
5398 PyErr_Format(PyExc_TypeError,
"unorderable types: int() >= %s()", type2->tp_name);
5400 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'int' and '%s'", type2->tp_name);
5408#if PYTHON_VERSION < 0x300
5410nuitka_bool RICH_COMPARE_GE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
5412 if (Py_TYPE(operand1) == &PyInt_Type) {
5413 return COMPARE_GE_CBOOL_INT_INT(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5416#if PYTHON_VERSION < 0x300
5417 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
5418 return NUITKA_BOOL_EXCEPTION;
5421 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
5422 return NUITKA_BOOL_EXCEPTION;
5426 PyTypeObject *type1 = Py_TYPE(operand1);
5428#if PYTHON_VERSION < 0x300
5430 if (type1 == &PyInt_Type && !0) {
5432 richcmpfunc frich = NULL;
5434 if (frich != NULL) {
5435 PyObject *result = (*frich)(operand1, operand2, Py_GE);
5437 if (result != Py_NotImplemented) {
5438 Py_LeaveRecursiveCall();
5440 if (unlikely(result == NULL)) {
5441 return NUITKA_BOOL_EXCEPTION;
5445 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5451 Py_DECREF_IMMORTAL(result);
5455 cmpfunc fcmp = PyInt_Type.tp_compare;
5458 int c = (*fcmp)(operand1, operand2);
5459 c = adjust_tp_compare(c);
5461 Py_LeaveRecursiveCall();
5464 return NUITKA_BOOL_EXCEPTION;
5487 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
5491 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5500 if (type1 != &PyInt_Type && 0) {
5504 PyObject *result = (*f)(operand2, operand1, Py_LE);
5506 if (result != Py_NotImplemented) {
5507 Py_LeaveRecursiveCall();
5509 if (unlikely(result == NULL)) {
5510 return NUITKA_BOOL_EXCEPTION;
5514 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5520 Py_DECREF_IMMORTAL(result);
5524 f = TP_RICHCOMPARE(type1);
5526 PyObject *result = (*f)(operand1, operand2, Py_GE);
5528 if (result != Py_NotImplemented) {
5529 Py_LeaveRecursiveCall();
5531 if (unlikely(result == NULL)) {
5532 return NUITKA_BOOL_EXCEPTION;
5536 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5542 Py_DECREF_IMMORTAL(result);
5547 PyObject *result = (*f)(operand2, operand1, Py_LE);
5549 if (result != Py_NotImplemented) {
5550 Py_LeaveRecursiveCall();
5552 if (unlikely(result == NULL)) {
5553 return NUITKA_BOOL_EXCEPTION;
5557 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5563 Py_DECREF_IMMORTAL(result);
5568 if (PyInstance_Check(operand1)) {
5569 cmpfunc fcmp = type1->tp_compare;
5570 c = (*fcmp)(operand1, operand2);
5572 cmpfunc fcmp = PyInt_Type.tp_compare;
5573 c = (*fcmp)(operand1, operand2);
5575 c = try_3way_compare(operand1, operand2);
5579 if (type1 == &PyInt_Type) {
5580 Py_uintptr_t aa = (Py_uintptr_t)operand1;
5581 Py_uintptr_t bb = (Py_uintptr_t)operand2;
5583 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5584 }
else if (operand1 == Py_None) {
5587 }
else if (operand2 == Py_None) {
5590 }
else if (PyNumber_Check(operand1)) {
5593 if (PyNumber_Check(operand2)) {
5595 Py_uintptr_t aa = (Py_uintptr_t)type1;
5596 Py_uintptr_t bb = (Py_uintptr_t)&PyInt_Type;
5598 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5602 }
else if (PyNumber_Check(operand2)) {
5606 int s = strcmp(type1->tp_name,
"int");
5614 Py_uintptr_t aa = (Py_uintptr_t)type1;
5615 Py_uintptr_t bb = (Py_uintptr_t)&PyInt_Type;
5617 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5622 Py_LeaveRecursiveCall();
5624 if (unlikely(c <= -2)) {
5625 return NUITKA_BOOL_EXCEPTION;
5650 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5654 bool checked_reverse_op =
false;
5657 if (type1 != &PyInt_Type && Nuitka_Type_IsSubtype(&PyInt_Type, type1)) {
5661 checked_reverse_op =
true;
5663 PyObject *result = (*f)(operand2, operand1, Py_LE);
5665 if (result != Py_NotImplemented) {
5666 Py_LeaveRecursiveCall();
5668 if (unlikely(result == NULL)) {
5669 return NUITKA_BOOL_EXCEPTION;
5673 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5679 Py_DECREF_IMMORTAL(result);
5683 f = TP_RICHCOMPARE(type1);
5686 PyObject *result = (*f)(operand1, operand2, Py_GE);
5688 if (result != Py_NotImplemented) {
5689 Py_LeaveRecursiveCall();
5691 if (unlikely(result == NULL)) {
5692 return NUITKA_BOOL_EXCEPTION;
5696 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5702 Py_DECREF_IMMORTAL(result);
5705 if (checked_reverse_op ==
false) {
5709 PyObject *result = (*f)(operand2, operand1, Py_LE);
5711 if (result != Py_NotImplemented) {
5712 Py_LeaveRecursiveCall();
5714 if (unlikely(result == NULL)) {
5715 return NUITKA_BOOL_EXCEPTION;
5719 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5725 Py_DECREF_IMMORTAL(result);
5729 Py_LeaveRecursiveCall();
5735 bool r = operand1 == operand2;
5736 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5741 bool r = operand1 != operand2;
5742 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5747#if PYTHON_VERSION < 0x360
5748 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= int()", type1->tp_name);
5750 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'int'", type1->tp_name);
5752 return NUITKA_BOOL_EXCEPTION;
5758#if PYTHON_VERSION < 0x300
5760nuitka_bool RICH_COMPARE_GE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
5762 if (&PyInt_Type == Py_TYPE(operand2)) {
5763 return COMPARE_GE_CBOOL_INT_INT(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5766#if PYTHON_VERSION < 0x300
5767 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
5768 return NUITKA_BOOL_EXCEPTION;
5771 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
5772 return NUITKA_BOOL_EXCEPTION;
5776 PyTypeObject *type2 = Py_TYPE(operand2);
5778#if PYTHON_VERSION < 0x300
5780 if (&PyInt_Type == type2 && !0) {
5782 richcmpfunc frich = NULL;
5784 if (frich != NULL) {
5785 PyObject *result = (*frich)(operand1, operand2, Py_GE);
5787 if (result != Py_NotImplemented) {
5788 Py_LeaveRecursiveCall();
5790 if (unlikely(result == NULL)) {
5791 return NUITKA_BOOL_EXCEPTION;
5795 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5801 Py_DECREF_IMMORTAL(result);
5805 cmpfunc fcmp = PyInt_Type.tp_compare;
5808 int c = (*fcmp)(operand1, operand2);
5809 c = adjust_tp_compare(c);
5811 Py_LeaveRecursiveCall();
5814 return NUITKA_BOOL_EXCEPTION;
5837 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
5841 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5850 if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5851 f = TP_RICHCOMPARE(type2);
5854 PyObject *result = (*f)(operand2, operand1, Py_LE);
5856 if (result != Py_NotImplemented) {
5857 Py_LeaveRecursiveCall();
5859 if (unlikely(result == NULL)) {
5860 return NUITKA_BOOL_EXCEPTION;
5864 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5870 Py_DECREF_IMMORTAL(result);
5876 PyObject *result = (*f)(operand1, operand2, Py_GE);
5878 if (result != Py_NotImplemented) {
5879 Py_LeaveRecursiveCall();
5881 if (unlikely(result == NULL)) {
5882 return NUITKA_BOOL_EXCEPTION;
5886 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5892 Py_DECREF_IMMORTAL(result);
5895 f = TP_RICHCOMPARE(type2);
5897 PyObject *result = (*f)(operand2, operand1, Py_LE);
5899 if (result != Py_NotImplemented) {
5900 Py_LeaveRecursiveCall();
5902 if (unlikely(result == NULL)) {
5903 return NUITKA_BOOL_EXCEPTION;
5907 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5913 Py_DECREF_IMMORTAL(result);
5919 cmpfunc fcmp = PyInt_Type.tp_compare;
5920 c = (*fcmp)(operand1, operand2);
5921 }
else if (PyInstance_Check(operand2)) {
5922 cmpfunc fcmp = type2->tp_compare;
5923 c = (*fcmp)(operand1, operand2);
5925 c = try_3way_compare(operand1, operand2);
5929 if (&PyInt_Type == type2) {
5930 Py_uintptr_t aa = (Py_uintptr_t)operand1;
5931 Py_uintptr_t bb = (Py_uintptr_t)operand2;
5933 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5934 }
else if (operand1 == Py_None) {
5937 }
else if (operand2 == Py_None) {
5940 }
else if (PyNumber_Check(operand1)) {
5943 if (PyNumber_Check(operand2)) {
5945 Py_uintptr_t aa = (Py_uintptr_t)&PyInt_Type;
5946 Py_uintptr_t bb = (Py_uintptr_t)type2;
5948 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5952 }
else if (PyNumber_Check(operand2)) {
5956 int s = strcmp(
"int", type2->tp_name);
5964 Py_uintptr_t aa = (Py_uintptr_t)&PyInt_Type;
5965 Py_uintptr_t bb = (Py_uintptr_t)type2;
5967 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5972 Py_LeaveRecursiveCall();
5974 if (unlikely(c <= -2)) {
5975 return NUITKA_BOOL_EXCEPTION;
6000 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6004 bool checked_reverse_op =
false;
6007 if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
6008 f = TP_RICHCOMPARE(type2);
6011 checked_reverse_op =
true;
6013 PyObject *result = (*f)(operand2, operand1, Py_LE);
6015 if (result != Py_NotImplemented) {
6016 Py_LeaveRecursiveCall();
6018 if (unlikely(result == NULL)) {
6019 return NUITKA_BOOL_EXCEPTION;
6023 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6029 Py_DECREF_IMMORTAL(result);
6036 PyObject *result = (*f)(operand1, operand2, Py_GE);
6038 if (result != Py_NotImplemented) {
6039 Py_LeaveRecursiveCall();
6041 if (unlikely(result == NULL)) {
6042 return NUITKA_BOOL_EXCEPTION;
6046 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6052 Py_DECREF_IMMORTAL(result);
6055 if (checked_reverse_op ==
false) {
6056 f = TP_RICHCOMPARE(type2);
6059 PyObject *result = (*f)(operand2, operand1, Py_LE);
6061 if (result != Py_NotImplemented) {
6062 Py_LeaveRecursiveCall();
6064 if (unlikely(result == NULL)) {
6065 return NUITKA_BOOL_EXCEPTION;
6069 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6075 Py_DECREF_IMMORTAL(result);
6079 Py_LeaveRecursiveCall();
6085 bool r = operand1 == operand2;
6086 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6091 bool r = operand1 != operand2;
6092 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6097#if PYTHON_VERSION < 0x360
6098 PyErr_Format(PyExc_TypeError,
"unorderable types: int() >= %s()", type2->tp_name);
6100 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'int' and '%s'", type2->tp_name);
6102 return NUITKA_BOOL_EXCEPTION;
6108static PyObject *COMPARE_GE_OBJECT_LONG_LONG(PyObject *operand1, PyObject *operand2) {
6109 CHECK_OBJECT(operand1);
6110 assert(PyLong_CheckExact(operand1));
6111 CHECK_OBJECT(operand2);
6112 assert(PyLong_CheckExact(operand2));
6114 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
6116 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
6120 if (operand1_long_object == operand2_long_object) {
6122 }
else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6123 Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6124 r = Nuitka_LongGetSignedDigitSize(operand1_long_object) - Nuitka_LongGetSignedDigitSize(operand2_long_object) >
6127 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6130 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6131 Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6132 r = Nuitka_LongGetDigitPointer(operand1_long_object)[i] >
6133 Nuitka_LongGetDigitPointer(operand2_long_object)[i];
6134 if (Nuitka_LongIsNegative(operand1_long_object)) {
6143 PyObject *result = BOOL_FROM(r);
6144 Py_INCREF_IMMORTAL(result);
6148PyObject *RICH_COMPARE_GE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
6150 if (Py_TYPE(operand1) == &PyLong_Type) {
6151 return COMPARE_GE_OBJECT_LONG_LONG(operand1, operand2);
6154#if PYTHON_VERSION < 0x300
6155 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
6159 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
6164 PyTypeObject *type1 = Py_TYPE(operand1);
6166#if PYTHON_VERSION < 0x300
6168 if (type1 == &PyLong_Type && !0) {
6170 richcmpfunc frich = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6172 if (frich != NULL) {
6173 PyObject *result = (*frich)(operand1, operand2, Py_GE);
6175 if (result != Py_NotImplemented) {
6176 Py_LeaveRecursiveCall();
6181 Py_DECREF_IMMORTAL(result);
6185 cmpfunc fcmp = PyLong_Type.tp_compare;
6188 int c = (*fcmp)(operand1, operand2);
6189 c = adjust_tp_compare(c);
6191 Py_LeaveRecursiveCall();
6217 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
6221 PyObject *result = BOOL_FROM(r);
6222 Py_INCREF_IMMORTAL(result);
6230 if (type1 != &PyLong_Type && 0) {
6231 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6234 PyObject *result = (*f)(operand2, operand1, Py_LE);
6236 if (result != Py_NotImplemented) {
6237 Py_LeaveRecursiveCall();
6242 Py_DECREF_IMMORTAL(result);
6246 f = TP_RICHCOMPARE(type1);
6248 PyObject *result = (*f)(operand1, operand2, Py_GE);
6250 if (result != Py_NotImplemented) {
6251 Py_LeaveRecursiveCall();
6256 Py_DECREF_IMMORTAL(result);
6259 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6261 PyObject *result = (*f)(operand2, operand1, Py_LE);
6263 if (result != Py_NotImplemented) {
6264 Py_LeaveRecursiveCall();
6269 Py_DECREF_IMMORTAL(result);
6274 if (PyInstance_Check(operand1)) {
6275 cmpfunc fcmp = type1->tp_compare;
6276 c = (*fcmp)(operand1, operand2);
6278 cmpfunc fcmp = PyLong_Type.tp_compare;
6279 c = (*fcmp)(operand1, operand2);
6281 c = try_3way_compare(operand1, operand2);
6285 if (type1 == &PyLong_Type) {
6286 Py_uintptr_t aa = (Py_uintptr_t)operand1;
6287 Py_uintptr_t bb = (Py_uintptr_t)operand2;
6289 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6290 }
else if (operand1 == Py_None) {
6293 }
else if (operand2 == Py_None) {
6296 }
else if (PyNumber_Check(operand1)) {
6299 if (PyNumber_Check(operand2)) {
6301 Py_uintptr_t aa = (Py_uintptr_t)type1;
6302 Py_uintptr_t bb = (Py_uintptr_t)&PyLong_Type;
6304 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6308 }
else if (PyNumber_Check(operand2)) {
6312 int s = strcmp(type1->tp_name, (PYTHON_VERSION < 0x300 ?
"long" :
"int"));
6320 Py_uintptr_t aa = (Py_uintptr_t)type1;
6321 Py_uintptr_t bb = (Py_uintptr_t)&PyLong_Type;
6323 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6328 Py_LeaveRecursiveCall();
6330 if (unlikely(c <= -2)) {
6356 PyObject *result = BOOL_FROM(r);
6357 Py_INCREF_IMMORTAL(result);
6360 bool checked_reverse_op =
false;
6363 if (type1 != &PyLong_Type && Nuitka_Type_IsSubtype(&PyLong_Type, type1)) {
6364 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6367 checked_reverse_op =
true;
6369 PyObject *result = (*f)(operand2, operand1, Py_LE);
6371 if (result != Py_NotImplemented) {
6372 Py_LeaveRecursiveCall();
6377 Py_DECREF_IMMORTAL(result);
6381 f = TP_RICHCOMPARE(type1);
6384 PyObject *result = (*f)(operand1, operand2, Py_GE);
6386 if (result != Py_NotImplemented) {
6387 Py_LeaveRecursiveCall();
6392 Py_DECREF_IMMORTAL(result);
6395 if (checked_reverse_op ==
false) {
6396 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6399 PyObject *result = (*f)(operand2, operand1, Py_LE);
6401 if (result != Py_NotImplemented) {
6402 Py_LeaveRecursiveCall();
6407 Py_DECREF_IMMORTAL(result);
6411 Py_LeaveRecursiveCall();
6417 bool r = operand1 == operand2;
6418 PyObject *result = BOOL_FROM(r);
6419 Py_INCREF_IMMORTAL(result);
6423 bool r = operand1 != operand2;
6424 PyObject *result = BOOL_FROM(r);
6425 Py_INCREF_IMMORTAL(result);
6429#if PYTHON_VERSION < 0x300
6430 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= long()", type1->tp_name);
6431#elif PYTHON_VERSION < 0x360
6432 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= int()", type1->tp_name);
6434 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'int'", type1->tp_name);
6442PyObject *RICH_COMPARE_GE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
6444 if (&PyLong_Type == Py_TYPE(operand2)) {
6445 return COMPARE_GE_OBJECT_LONG_LONG(operand1, operand2);
6448#if PYTHON_VERSION < 0x300
6449 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
6453 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
6458 PyTypeObject *type2 = Py_TYPE(operand2);
6460#if PYTHON_VERSION < 0x300
6462 if (&PyLong_Type == type2 && !0) {
6464 richcmpfunc frich = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6466 if (frich != NULL) {
6467 PyObject *result = (*frich)(operand1, operand2, Py_GE);
6469 if (result != Py_NotImplemented) {
6470 Py_LeaveRecursiveCall();
6475 Py_DECREF_IMMORTAL(result);
6479 cmpfunc fcmp = PyLong_Type.tp_compare;
6482 int c = (*fcmp)(operand1, operand2);
6483 c = adjust_tp_compare(c);
6485 Py_LeaveRecursiveCall();
6511 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
6515 PyObject *result = BOOL_FROM(r);
6516 Py_INCREF_IMMORTAL(result);
6524 if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6525 f = TP_RICHCOMPARE(type2);
6528 PyObject *result = (*f)(operand2, operand1, Py_LE);
6530 if (result != Py_NotImplemented) {
6531 Py_LeaveRecursiveCall();
6536 Py_DECREF_IMMORTAL(result);
6540 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6542 PyObject *result = (*f)(operand1, operand2, Py_GE);
6544 if (result != Py_NotImplemented) {
6545 Py_LeaveRecursiveCall();
6550 Py_DECREF_IMMORTAL(result);
6553 f = TP_RICHCOMPARE(type2);
6555 PyObject *result = (*f)(operand2, operand1, Py_LE);
6557 if (result != Py_NotImplemented) {
6558 Py_LeaveRecursiveCall();
6563 Py_DECREF_IMMORTAL(result);
6569 cmpfunc fcmp = PyLong_Type.tp_compare;
6570 c = (*fcmp)(operand1, operand2);
6571 }
else if (PyInstance_Check(operand2)) {
6572 cmpfunc fcmp = type2->tp_compare;
6573 c = (*fcmp)(operand1, operand2);
6575 c = try_3way_compare(operand1, operand2);
6579 if (&PyLong_Type == type2) {
6580 Py_uintptr_t aa = (Py_uintptr_t)operand1;
6581 Py_uintptr_t bb = (Py_uintptr_t)operand2;
6583 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6584 }
else if (operand1 == Py_None) {
6587 }
else if (operand2 == Py_None) {
6590 }
else if (PyNumber_Check(operand1)) {
6593 if (PyNumber_Check(operand2)) {
6595 Py_uintptr_t aa = (Py_uintptr_t)&PyLong_Type;
6596 Py_uintptr_t bb = (Py_uintptr_t)type2;
6598 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6602 }
else if (PyNumber_Check(operand2)) {
6606 int s = strcmp((PYTHON_VERSION < 0x300 ?
"long" :
"int"), type2->tp_name);
6614 Py_uintptr_t aa = (Py_uintptr_t)&PyLong_Type;
6615 Py_uintptr_t bb = (Py_uintptr_t)type2;
6617 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6622 Py_LeaveRecursiveCall();
6624 if (unlikely(c <= -2)) {
6650 PyObject *result = BOOL_FROM(r);
6651 Py_INCREF_IMMORTAL(result);
6654 bool checked_reverse_op =
false;
6657 if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6658 f = TP_RICHCOMPARE(type2);
6661 checked_reverse_op =
true;
6663 PyObject *result = (*f)(operand2, operand1, Py_LE);
6665 if (result != Py_NotImplemented) {
6666 Py_LeaveRecursiveCall();
6671 Py_DECREF_IMMORTAL(result);
6675 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6678 PyObject *result = (*f)(operand1, operand2, Py_GE);
6680 if (result != Py_NotImplemented) {
6681 Py_LeaveRecursiveCall();
6686 Py_DECREF_IMMORTAL(result);
6689 if (checked_reverse_op ==
false) {
6690 f = TP_RICHCOMPARE(type2);
6693 PyObject *result = (*f)(operand2, operand1, Py_LE);
6695 if (result != Py_NotImplemented) {
6696 Py_LeaveRecursiveCall();
6701 Py_DECREF_IMMORTAL(result);
6705 Py_LeaveRecursiveCall();
6711 bool r = operand1 == operand2;
6712 PyObject *result = BOOL_FROM(r);
6713 Py_INCREF_IMMORTAL(result);
6717 bool r = operand1 != operand2;
6718 PyObject *result = BOOL_FROM(r);
6719 Py_INCREF_IMMORTAL(result);
6723#if PYTHON_VERSION < 0x300
6724 PyErr_Format(PyExc_TypeError,
"unorderable types: long() >= %s()", type2->tp_name);
6725#elif PYTHON_VERSION < 0x360
6726 PyErr_Format(PyExc_TypeError,
"unorderable types: int() >= %s()", type2->tp_name);
6728 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'int' and '%s'", type2->tp_name);
6735static bool COMPARE_GE_CBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
6736 CHECK_OBJECT(operand1);
6737 assert(PyLong_CheckExact(operand1));
6738 CHECK_OBJECT(operand2);
6739 assert(PyLong_CheckExact(operand2));
6741 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
6743 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
6747 if (operand1_long_object == operand2_long_object) {
6749 }
else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6750 Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6751 r = Nuitka_LongGetSignedDigitSize(operand1_long_object) - Nuitka_LongGetSignedDigitSize(operand2_long_object) >
6754 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6757 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6758 Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6759 r = Nuitka_LongGetDigitPointer(operand1_long_object)[i] >
6760 Nuitka_LongGetDigitPointer(operand2_long_object)[i];
6761 if (Nuitka_LongIsNegative(operand1_long_object)) {
6775nuitka_bool RICH_COMPARE_GE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
6777 if (Py_TYPE(operand1) == &PyLong_Type) {
6778 return COMPARE_GE_CBOOL_LONG_LONG(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6781#if PYTHON_VERSION < 0x300
6782 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
6783 return NUITKA_BOOL_EXCEPTION;
6786 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
6787 return NUITKA_BOOL_EXCEPTION;
6791 PyTypeObject *type1 = Py_TYPE(operand1);
6793#if PYTHON_VERSION < 0x300
6795 if (type1 == &PyLong_Type && !0) {
6797 richcmpfunc frich = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6799 if (frich != NULL) {
6800 PyObject *result = (*frich)(operand1, operand2, Py_GE);
6802 if (result != Py_NotImplemented) {
6803 Py_LeaveRecursiveCall();
6805 if (unlikely(result == NULL)) {
6806 return NUITKA_BOOL_EXCEPTION;
6810 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6816 Py_DECREF_IMMORTAL(result);
6820 cmpfunc fcmp = PyLong_Type.tp_compare;
6823 int c = (*fcmp)(operand1, operand2);
6824 c = adjust_tp_compare(c);
6826 Py_LeaveRecursiveCall();
6829 return NUITKA_BOOL_EXCEPTION;
6852 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
6856 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6865 if (type1 != &PyLong_Type && 0) {
6866 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6869 PyObject *result = (*f)(operand2, operand1, Py_LE);
6871 if (result != Py_NotImplemented) {
6872 Py_LeaveRecursiveCall();
6874 if (unlikely(result == NULL)) {
6875 return NUITKA_BOOL_EXCEPTION;
6879 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6885 Py_DECREF_IMMORTAL(result);
6889 f = TP_RICHCOMPARE(type1);
6891 PyObject *result = (*f)(operand1, operand2, Py_GE);
6893 if (result != Py_NotImplemented) {
6894 Py_LeaveRecursiveCall();
6896 if (unlikely(result == NULL)) {
6897 return NUITKA_BOOL_EXCEPTION;
6901 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6907 Py_DECREF_IMMORTAL(result);
6910 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6912 PyObject *result = (*f)(operand2, operand1, Py_LE);
6914 if (result != Py_NotImplemented) {
6915 Py_LeaveRecursiveCall();
6917 if (unlikely(result == NULL)) {
6918 return NUITKA_BOOL_EXCEPTION;
6922 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6928 Py_DECREF_IMMORTAL(result);
6933 if (PyInstance_Check(operand1)) {
6934 cmpfunc fcmp = type1->tp_compare;
6935 c = (*fcmp)(operand1, operand2);
6937 cmpfunc fcmp = PyLong_Type.tp_compare;
6938 c = (*fcmp)(operand1, operand2);
6940 c = try_3way_compare(operand1, operand2);
6944 if (type1 == &PyLong_Type) {
6945 Py_uintptr_t aa = (Py_uintptr_t)operand1;
6946 Py_uintptr_t bb = (Py_uintptr_t)operand2;
6948 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6949 }
else if (operand1 == Py_None) {
6952 }
else if (operand2 == Py_None) {
6955 }
else if (PyNumber_Check(operand1)) {
6958 if (PyNumber_Check(operand2)) {
6960 Py_uintptr_t aa = (Py_uintptr_t)type1;
6961 Py_uintptr_t bb = (Py_uintptr_t)&PyLong_Type;
6963 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6967 }
else if (PyNumber_Check(operand2)) {
6971 int s = strcmp(type1->tp_name, (PYTHON_VERSION < 0x300 ?
"long" :
"int"));
6979 Py_uintptr_t aa = (Py_uintptr_t)type1;
6980 Py_uintptr_t bb = (Py_uintptr_t)&PyLong_Type;
6982 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6987 Py_LeaveRecursiveCall();
6989 if (unlikely(c <= -2)) {
6990 return NUITKA_BOOL_EXCEPTION;
7015 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7019 bool checked_reverse_op =
false;
7022 if (type1 != &PyLong_Type && Nuitka_Type_IsSubtype(&PyLong_Type, type1)) {
7023 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
7026 checked_reverse_op =
true;
7028 PyObject *result = (*f)(operand2, operand1, Py_LE);
7030 if (result != Py_NotImplemented) {
7031 Py_LeaveRecursiveCall();
7033 if (unlikely(result == NULL)) {
7034 return NUITKA_BOOL_EXCEPTION;
7038 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7044 Py_DECREF_IMMORTAL(result);
7048 f = TP_RICHCOMPARE(type1);
7051 PyObject *result = (*f)(operand1, operand2, Py_GE);
7053 if (result != Py_NotImplemented) {
7054 Py_LeaveRecursiveCall();
7056 if (unlikely(result == NULL)) {
7057 return NUITKA_BOOL_EXCEPTION;
7061 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7067 Py_DECREF_IMMORTAL(result);
7070 if (checked_reverse_op ==
false) {
7071 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
7074 PyObject *result = (*f)(operand2, operand1, Py_LE);
7076 if (result != Py_NotImplemented) {
7077 Py_LeaveRecursiveCall();
7079 if (unlikely(result == NULL)) {
7080 return NUITKA_BOOL_EXCEPTION;
7084 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7090 Py_DECREF_IMMORTAL(result);
7094 Py_LeaveRecursiveCall();
7100 bool r = operand1 == operand2;
7101 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7106 bool r = operand1 != operand2;
7107 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7112#if PYTHON_VERSION < 0x300
7113 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= long()", type1->tp_name);
7114#elif PYTHON_VERSION < 0x360
7115 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= int()", type1->tp_name);
7117 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'int'", type1->tp_name);
7119 return NUITKA_BOOL_EXCEPTION;
7125nuitka_bool RICH_COMPARE_GE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
7127 if (&PyLong_Type == Py_TYPE(operand2)) {
7128 return COMPARE_GE_CBOOL_LONG_LONG(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7131#if PYTHON_VERSION < 0x300
7132 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
7133 return NUITKA_BOOL_EXCEPTION;
7136 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
7137 return NUITKA_BOOL_EXCEPTION;
7141 PyTypeObject *type2 = Py_TYPE(operand2);
7143#if PYTHON_VERSION < 0x300
7145 if (&PyLong_Type == type2 && !0) {
7147 richcmpfunc frich = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
7149 if (frich != NULL) {
7150 PyObject *result = (*frich)(operand1, operand2, Py_GE);
7152 if (result != Py_NotImplemented) {
7153 Py_LeaveRecursiveCall();
7155 if (unlikely(result == NULL)) {
7156 return NUITKA_BOOL_EXCEPTION;
7160 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7166 Py_DECREF_IMMORTAL(result);
7170 cmpfunc fcmp = PyLong_Type.tp_compare;
7173 int c = (*fcmp)(operand1, operand2);
7174 c = adjust_tp_compare(c);
7176 Py_LeaveRecursiveCall();
7179 return NUITKA_BOOL_EXCEPTION;
7202 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
7206 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7215 if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7216 f = TP_RICHCOMPARE(type2);
7219 PyObject *result = (*f)(operand2, operand1, Py_LE);
7221 if (result != Py_NotImplemented) {
7222 Py_LeaveRecursiveCall();
7224 if (unlikely(result == NULL)) {
7225 return NUITKA_BOOL_EXCEPTION;
7229 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7235 Py_DECREF_IMMORTAL(result);
7239 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
7241 PyObject *result = (*f)(operand1, operand2, Py_GE);
7243 if (result != Py_NotImplemented) {
7244 Py_LeaveRecursiveCall();
7246 if (unlikely(result == NULL)) {
7247 return NUITKA_BOOL_EXCEPTION;
7251 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7257 Py_DECREF_IMMORTAL(result);
7260 f = TP_RICHCOMPARE(type2);
7262 PyObject *result = (*f)(operand2, operand1, Py_LE);
7264 if (result != Py_NotImplemented) {
7265 Py_LeaveRecursiveCall();
7267 if (unlikely(result == NULL)) {
7268 return NUITKA_BOOL_EXCEPTION;
7272 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7278 Py_DECREF_IMMORTAL(result);
7284 cmpfunc fcmp = PyLong_Type.tp_compare;
7285 c = (*fcmp)(operand1, operand2);
7286 }
else if (PyInstance_Check(operand2)) {
7287 cmpfunc fcmp = type2->tp_compare;
7288 c = (*fcmp)(operand1, operand2);
7290 c = try_3way_compare(operand1, operand2);
7294 if (&PyLong_Type == type2) {
7295 Py_uintptr_t aa = (Py_uintptr_t)operand1;
7296 Py_uintptr_t bb = (Py_uintptr_t)operand2;
7298 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7299 }
else if (operand1 == Py_None) {
7302 }
else if (operand2 == Py_None) {
7305 }
else if (PyNumber_Check(operand1)) {
7308 if (PyNumber_Check(operand2)) {
7310 Py_uintptr_t aa = (Py_uintptr_t)&PyLong_Type;
7311 Py_uintptr_t bb = (Py_uintptr_t)type2;
7313 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7317 }
else if (PyNumber_Check(operand2)) {
7321 int s = strcmp((PYTHON_VERSION < 0x300 ?
"long" :
"int"), type2->tp_name);
7329 Py_uintptr_t aa = (Py_uintptr_t)&PyLong_Type;
7330 Py_uintptr_t bb = (Py_uintptr_t)type2;
7332 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7337 Py_LeaveRecursiveCall();
7339 if (unlikely(c <= -2)) {
7340 return NUITKA_BOOL_EXCEPTION;
7365 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7369 bool checked_reverse_op =
false;
7372 if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7373 f = TP_RICHCOMPARE(type2);
7376 checked_reverse_op =
true;
7378 PyObject *result = (*f)(operand2, operand1, Py_LE);
7380 if (result != Py_NotImplemented) {
7381 Py_LeaveRecursiveCall();
7383 if (unlikely(result == NULL)) {
7384 return NUITKA_BOOL_EXCEPTION;
7388 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7394 Py_DECREF_IMMORTAL(result);
7398 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
7401 PyObject *result = (*f)(operand1, operand2, Py_GE);
7403 if (result != Py_NotImplemented) {
7404 Py_LeaveRecursiveCall();
7406 if (unlikely(result == NULL)) {
7407 return NUITKA_BOOL_EXCEPTION;
7411 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7417 Py_DECREF_IMMORTAL(result);
7420 if (checked_reverse_op ==
false) {
7421 f = TP_RICHCOMPARE(type2);
7424 PyObject *result = (*f)(operand2, operand1, Py_LE);
7426 if (result != Py_NotImplemented) {
7427 Py_LeaveRecursiveCall();
7429 if (unlikely(result == NULL)) {
7430 return NUITKA_BOOL_EXCEPTION;
7434 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7440 Py_DECREF_IMMORTAL(result);
7444 Py_LeaveRecursiveCall();
7450 bool r = operand1 == operand2;
7451 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7456 bool r = operand1 != operand2;
7457 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7462#if PYTHON_VERSION < 0x300
7463 PyErr_Format(PyExc_TypeError,
"unorderable types: long() >= %s()", type2->tp_name);
7464#elif PYTHON_VERSION < 0x360
7465 PyErr_Format(PyExc_TypeError,
"unorderable types: int() >= %s()", type2->tp_name);
7467 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'int' and '%s'", type2->tp_name);
7469 return NUITKA_BOOL_EXCEPTION;
7474static PyObject *COMPARE_GE_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
7475 CHECK_OBJECT(operand1);
7476 assert(PyFloat_CheckExact(operand1));
7477 CHECK_OBJECT(operand2);
7478 assert(PyFloat_CheckExact(operand2));
7480 const double a = PyFloat_AS_DOUBLE(operand1);
7481 const double b = PyFloat_AS_DOUBLE(operand2);
7486 PyObject *result = BOOL_FROM(r);
7487 Py_INCREF_IMMORTAL(result);
7491PyObject *RICH_COMPARE_GE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
7493 if (Py_TYPE(operand1) == &PyFloat_Type) {
7494 return COMPARE_GE_OBJECT_FLOAT_FLOAT(operand1, operand2);
7497#if PYTHON_VERSION < 0x300
7498 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
7502 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
7507 PyTypeObject *type1 = Py_TYPE(operand1);
7509#if PYTHON_VERSION < 0x300
7511 if (type1 == &PyFloat_Type && !0) {
7513 richcmpfunc frich = PyFloat_Type.tp_richcompare;
7515 if (frich != NULL) {
7516 PyObject *result = (*frich)(operand1, operand2, Py_GE);
7518 if (result != Py_NotImplemented) {
7519 Py_LeaveRecursiveCall();
7524 Py_DECREF_IMMORTAL(result);
7528 cmpfunc fcmp = NULL;
7531 int c = (*fcmp)(operand1, operand2);
7532 c = adjust_tp_compare(c);
7534 Py_LeaveRecursiveCall();
7560 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
7564 PyObject *result = BOOL_FROM(r);
7565 Py_INCREF_IMMORTAL(result);
7573 if (type1 != &PyFloat_Type && 0) {
7574 f = PyFloat_Type.tp_richcompare;
7577 PyObject *result = (*f)(operand2, operand1, Py_LE);
7579 if (result != Py_NotImplemented) {
7580 Py_LeaveRecursiveCall();
7585 Py_DECREF_IMMORTAL(result);
7589 f = TP_RICHCOMPARE(type1);
7591 PyObject *result = (*f)(operand1, operand2, Py_GE);
7593 if (result != Py_NotImplemented) {
7594 Py_LeaveRecursiveCall();
7599 Py_DECREF_IMMORTAL(result);
7602 f = PyFloat_Type.tp_richcompare;
7604 PyObject *result = (*f)(operand2, operand1, Py_LE);
7606 if (result != Py_NotImplemented) {
7607 Py_LeaveRecursiveCall();
7612 Py_DECREF_IMMORTAL(result);
7617 if (PyInstance_Check(operand1)) {
7618 cmpfunc fcmp = type1->tp_compare;
7619 c = (*fcmp)(operand1, operand2);
7621 cmpfunc fcmp = NULL;
7622 c = (*fcmp)(operand1, operand2);
7624 c = try_3way_compare(operand1, operand2);
7628 if (type1 == &PyFloat_Type) {
7629 Py_uintptr_t aa = (Py_uintptr_t)operand1;
7630 Py_uintptr_t bb = (Py_uintptr_t)operand2;
7632 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7633 }
else if (operand1 == Py_None) {
7636 }
else if (operand2 == Py_None) {
7639 }
else if (PyNumber_Check(operand1)) {
7642 if (PyNumber_Check(operand2)) {
7644 Py_uintptr_t aa = (Py_uintptr_t)type1;
7645 Py_uintptr_t bb = (Py_uintptr_t)&PyFloat_Type;
7647 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7651 }
else if (PyNumber_Check(operand2)) {
7655 int s = strcmp(type1->tp_name,
"float");
7663 Py_uintptr_t aa = (Py_uintptr_t)type1;
7664 Py_uintptr_t bb = (Py_uintptr_t)&PyFloat_Type;
7666 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7671 Py_LeaveRecursiveCall();
7673 if (unlikely(c <= -2)) {
7699 PyObject *result = BOOL_FROM(r);
7700 Py_INCREF_IMMORTAL(result);
7703 bool checked_reverse_op =
false;
7706 if (type1 != &PyFloat_Type && Nuitka_Type_IsSubtype(&PyFloat_Type, type1)) {
7707 f = PyFloat_Type.tp_richcompare;
7710 checked_reverse_op =
true;
7712 PyObject *result = (*f)(operand2, operand1, Py_LE);
7714 if (result != Py_NotImplemented) {
7715 Py_LeaveRecursiveCall();
7720 Py_DECREF_IMMORTAL(result);
7724 f = TP_RICHCOMPARE(type1);
7727 PyObject *result = (*f)(operand1, operand2, Py_GE);
7729 if (result != Py_NotImplemented) {
7730 Py_LeaveRecursiveCall();
7735 Py_DECREF_IMMORTAL(result);
7738 if (checked_reverse_op ==
false) {
7739 f = PyFloat_Type.tp_richcompare;
7742 PyObject *result = (*f)(operand2, operand1, Py_LE);
7744 if (result != Py_NotImplemented) {
7745 Py_LeaveRecursiveCall();
7750 Py_DECREF_IMMORTAL(result);
7754 Py_LeaveRecursiveCall();
7760 bool r = operand1 == operand2;
7761 PyObject *result = BOOL_FROM(r);
7762 Py_INCREF_IMMORTAL(result);
7766 bool r = operand1 != operand2;
7767 PyObject *result = BOOL_FROM(r);
7768 Py_INCREF_IMMORTAL(result);
7772#if PYTHON_VERSION < 0x360
7773 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= float()", type1->tp_name);
7775 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'float'", type1->tp_name);
7783PyObject *RICH_COMPARE_GE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
7785 if (&PyFloat_Type == Py_TYPE(operand2)) {
7786 return COMPARE_GE_OBJECT_FLOAT_FLOAT(operand1, operand2);
7789#if PYTHON_VERSION < 0x300
7790 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
7794 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
7799 PyTypeObject *type2 = Py_TYPE(operand2);
7801#if PYTHON_VERSION < 0x300
7803 if (&PyFloat_Type == type2 && !0) {
7805 richcmpfunc frich = PyFloat_Type.tp_richcompare;
7807 if (frich != NULL) {
7808 PyObject *result = (*frich)(operand1, operand2, Py_GE);
7810 if (result != Py_NotImplemented) {
7811 Py_LeaveRecursiveCall();
7816 Py_DECREF_IMMORTAL(result);
7820 cmpfunc fcmp = NULL;
7823 int c = (*fcmp)(operand1, operand2);
7824 c = adjust_tp_compare(c);
7826 Py_LeaveRecursiveCall();
7852 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
7856 PyObject *result = BOOL_FROM(r);
7857 Py_INCREF_IMMORTAL(result);
7865 if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
7866 f = TP_RICHCOMPARE(type2);
7869 PyObject *result = (*f)(operand2, operand1, Py_LE);
7871 if (result != Py_NotImplemented) {
7872 Py_LeaveRecursiveCall();
7877 Py_DECREF_IMMORTAL(result);
7881 f = PyFloat_Type.tp_richcompare;
7883 PyObject *result = (*f)(operand1, operand2, Py_GE);
7885 if (result != Py_NotImplemented) {
7886 Py_LeaveRecursiveCall();
7891 Py_DECREF_IMMORTAL(result);
7894 f = TP_RICHCOMPARE(type2);
7896 PyObject *result = (*f)(operand2, operand1, Py_LE);
7898 if (result != Py_NotImplemented) {
7899 Py_LeaveRecursiveCall();
7904 Py_DECREF_IMMORTAL(result);
7910 cmpfunc fcmp = NULL;
7911 c = (*fcmp)(operand1, operand2);
7912 }
else if (PyInstance_Check(operand2)) {
7913 cmpfunc fcmp = type2->tp_compare;
7914 c = (*fcmp)(operand1, operand2);
7916 c = try_3way_compare(operand1, operand2);
7920 if (&PyFloat_Type == type2) {
7921 Py_uintptr_t aa = (Py_uintptr_t)operand1;
7922 Py_uintptr_t bb = (Py_uintptr_t)operand2;
7924 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7925 }
else if (operand1 == Py_None) {
7928 }
else if (operand2 == Py_None) {
7931 }
else if (PyNumber_Check(operand1)) {
7934 if (PyNumber_Check(operand2)) {
7936 Py_uintptr_t aa = (Py_uintptr_t)&PyFloat_Type;
7937 Py_uintptr_t bb = (Py_uintptr_t)type2;
7939 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7943 }
else if (PyNumber_Check(operand2)) {
7947 int s = strcmp(
"float", type2->tp_name);
7955 Py_uintptr_t aa = (Py_uintptr_t)&PyFloat_Type;
7956 Py_uintptr_t bb = (Py_uintptr_t)type2;
7958 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7963 Py_LeaveRecursiveCall();
7965 if (unlikely(c <= -2)) {
7991 PyObject *result = BOOL_FROM(r);
7992 Py_INCREF_IMMORTAL(result);
7995 bool checked_reverse_op =
false;
7998 if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
7999 f = TP_RICHCOMPARE(type2);
8002 checked_reverse_op =
true;
8004 PyObject *result = (*f)(operand2, operand1, Py_LE);
8006 if (result != Py_NotImplemented) {
8007 Py_LeaveRecursiveCall();
8012 Py_DECREF_IMMORTAL(result);
8016 f = PyFloat_Type.tp_richcompare;
8019 PyObject *result = (*f)(operand1, operand2, Py_GE);
8021 if (result != Py_NotImplemented) {
8022 Py_LeaveRecursiveCall();
8027 Py_DECREF_IMMORTAL(result);
8030 if (checked_reverse_op ==
false) {
8031 f = TP_RICHCOMPARE(type2);
8034 PyObject *result = (*f)(operand2, operand1, Py_LE);
8036 if (result != Py_NotImplemented) {
8037 Py_LeaveRecursiveCall();
8042 Py_DECREF_IMMORTAL(result);
8046 Py_LeaveRecursiveCall();
8052 bool r = operand1 == operand2;
8053 PyObject *result = BOOL_FROM(r);
8054 Py_INCREF_IMMORTAL(result);
8058 bool r = operand1 != operand2;
8059 PyObject *result = BOOL_FROM(r);
8060 Py_INCREF_IMMORTAL(result);
8064#if PYTHON_VERSION < 0x360
8065 PyErr_Format(PyExc_TypeError,
"unorderable types: float() >= %s()", type2->tp_name);
8067 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'float' and '%s'", type2->tp_name);
8074static bool COMPARE_GE_CBOOL_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
8075 CHECK_OBJECT(operand1);
8076 assert(PyFloat_CheckExact(operand1));
8077 CHECK_OBJECT(operand2);
8078 assert(PyFloat_CheckExact(operand2));
8080 const double a = PyFloat_AS_DOUBLE(operand1);
8081 const double b = PyFloat_AS_DOUBLE(operand2);
8091nuitka_bool RICH_COMPARE_GE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
8093 if (Py_TYPE(operand1) == &PyFloat_Type) {
8094 return COMPARE_GE_CBOOL_FLOAT_FLOAT(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8097#if PYTHON_VERSION < 0x300
8098 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
8099 return NUITKA_BOOL_EXCEPTION;
8102 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
8103 return NUITKA_BOOL_EXCEPTION;
8107 PyTypeObject *type1 = Py_TYPE(operand1);
8109#if PYTHON_VERSION < 0x300
8111 if (type1 == &PyFloat_Type && !0) {
8113 richcmpfunc frich = PyFloat_Type.tp_richcompare;
8115 if (frich != NULL) {
8116 PyObject *result = (*frich)(operand1, operand2, Py_GE);
8118 if (result != Py_NotImplemented) {
8119 Py_LeaveRecursiveCall();
8121 if (unlikely(result == NULL)) {
8122 return NUITKA_BOOL_EXCEPTION;
8126 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8132 Py_DECREF_IMMORTAL(result);
8136 cmpfunc fcmp = NULL;
8139 int c = (*fcmp)(operand1, operand2);
8140 c = adjust_tp_compare(c);
8142 Py_LeaveRecursiveCall();
8145 return NUITKA_BOOL_EXCEPTION;
8168 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
8172 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8181 if (type1 != &PyFloat_Type && 0) {
8182 f = PyFloat_Type.tp_richcompare;
8185 PyObject *result = (*f)(operand2, operand1, Py_LE);
8187 if (result != Py_NotImplemented) {
8188 Py_LeaveRecursiveCall();
8190 if (unlikely(result == NULL)) {
8191 return NUITKA_BOOL_EXCEPTION;
8195 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8201 Py_DECREF_IMMORTAL(result);
8205 f = TP_RICHCOMPARE(type1);
8207 PyObject *result = (*f)(operand1, operand2, Py_GE);
8209 if (result != Py_NotImplemented) {
8210 Py_LeaveRecursiveCall();
8212 if (unlikely(result == NULL)) {
8213 return NUITKA_BOOL_EXCEPTION;
8217 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8223 Py_DECREF_IMMORTAL(result);
8226 f = PyFloat_Type.tp_richcompare;
8228 PyObject *result = (*f)(operand2, operand1, Py_LE);
8230 if (result != Py_NotImplemented) {
8231 Py_LeaveRecursiveCall();
8233 if (unlikely(result == NULL)) {
8234 return NUITKA_BOOL_EXCEPTION;
8238 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8244 Py_DECREF_IMMORTAL(result);
8249 if (PyInstance_Check(operand1)) {
8250 cmpfunc fcmp = type1->tp_compare;
8251 c = (*fcmp)(operand1, operand2);
8253 cmpfunc fcmp = NULL;
8254 c = (*fcmp)(operand1, operand2);
8256 c = try_3way_compare(operand1, operand2);
8260 if (type1 == &PyFloat_Type) {
8261 Py_uintptr_t aa = (Py_uintptr_t)operand1;
8262 Py_uintptr_t bb = (Py_uintptr_t)operand2;
8264 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8265 }
else if (operand1 == Py_None) {
8268 }
else if (operand2 == Py_None) {
8271 }
else if (PyNumber_Check(operand1)) {
8274 if (PyNumber_Check(operand2)) {
8276 Py_uintptr_t aa = (Py_uintptr_t)type1;
8277 Py_uintptr_t bb = (Py_uintptr_t)&PyFloat_Type;
8279 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8283 }
else if (PyNumber_Check(operand2)) {
8287 int s = strcmp(type1->tp_name,
"float");
8295 Py_uintptr_t aa = (Py_uintptr_t)type1;
8296 Py_uintptr_t bb = (Py_uintptr_t)&PyFloat_Type;
8298 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8303 Py_LeaveRecursiveCall();
8305 if (unlikely(c <= -2)) {
8306 return NUITKA_BOOL_EXCEPTION;
8331 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8335 bool checked_reverse_op =
false;
8338 if (type1 != &PyFloat_Type && Nuitka_Type_IsSubtype(&PyFloat_Type, type1)) {
8339 f = PyFloat_Type.tp_richcompare;
8342 checked_reverse_op =
true;
8344 PyObject *result = (*f)(operand2, operand1, Py_LE);
8346 if (result != Py_NotImplemented) {
8347 Py_LeaveRecursiveCall();
8349 if (unlikely(result == NULL)) {
8350 return NUITKA_BOOL_EXCEPTION;
8354 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8360 Py_DECREF_IMMORTAL(result);
8364 f = TP_RICHCOMPARE(type1);
8367 PyObject *result = (*f)(operand1, operand2, Py_GE);
8369 if (result != Py_NotImplemented) {
8370 Py_LeaveRecursiveCall();
8372 if (unlikely(result == NULL)) {
8373 return NUITKA_BOOL_EXCEPTION;
8377 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8383 Py_DECREF_IMMORTAL(result);
8386 if (checked_reverse_op ==
false) {
8387 f = PyFloat_Type.tp_richcompare;
8390 PyObject *result = (*f)(operand2, operand1, Py_LE);
8392 if (result != Py_NotImplemented) {
8393 Py_LeaveRecursiveCall();
8395 if (unlikely(result == NULL)) {
8396 return NUITKA_BOOL_EXCEPTION;
8400 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8406 Py_DECREF_IMMORTAL(result);
8410 Py_LeaveRecursiveCall();
8416 bool r = operand1 == operand2;
8417 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8422 bool r = operand1 != operand2;
8423 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8428#if PYTHON_VERSION < 0x360
8429 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= float()", type1->tp_name);
8431 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'float'", type1->tp_name);
8433 return NUITKA_BOOL_EXCEPTION;
8439nuitka_bool RICH_COMPARE_GE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
8441 if (&PyFloat_Type == Py_TYPE(operand2)) {
8442 return COMPARE_GE_CBOOL_FLOAT_FLOAT(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8445#if PYTHON_VERSION < 0x300
8446 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
8447 return NUITKA_BOOL_EXCEPTION;
8450 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
8451 return NUITKA_BOOL_EXCEPTION;
8455 PyTypeObject *type2 = Py_TYPE(operand2);
8457#if PYTHON_VERSION < 0x300
8459 if (&PyFloat_Type == type2 && !0) {
8461 richcmpfunc frich = PyFloat_Type.tp_richcompare;
8463 if (frich != NULL) {
8464 PyObject *result = (*frich)(operand1, operand2, Py_GE);
8466 if (result != Py_NotImplemented) {
8467 Py_LeaveRecursiveCall();
8469 if (unlikely(result == NULL)) {
8470 return NUITKA_BOOL_EXCEPTION;
8474 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8480 Py_DECREF_IMMORTAL(result);
8484 cmpfunc fcmp = NULL;
8487 int c = (*fcmp)(operand1, operand2);
8488 c = adjust_tp_compare(c);
8490 Py_LeaveRecursiveCall();
8493 return NUITKA_BOOL_EXCEPTION;
8516 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
8520 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8529 if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8530 f = TP_RICHCOMPARE(type2);
8533 PyObject *result = (*f)(operand2, operand1, Py_LE);
8535 if (result != Py_NotImplemented) {
8536 Py_LeaveRecursiveCall();
8538 if (unlikely(result == NULL)) {
8539 return NUITKA_BOOL_EXCEPTION;
8543 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8549 Py_DECREF_IMMORTAL(result);
8553 f = PyFloat_Type.tp_richcompare;
8555 PyObject *result = (*f)(operand1, operand2, Py_GE);
8557 if (result != Py_NotImplemented) {
8558 Py_LeaveRecursiveCall();
8560 if (unlikely(result == NULL)) {
8561 return NUITKA_BOOL_EXCEPTION;
8565 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8571 Py_DECREF_IMMORTAL(result);
8574 f = TP_RICHCOMPARE(type2);
8576 PyObject *result = (*f)(operand2, operand1, Py_LE);
8578 if (result != Py_NotImplemented) {
8579 Py_LeaveRecursiveCall();
8581 if (unlikely(result == NULL)) {
8582 return NUITKA_BOOL_EXCEPTION;
8586 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8592 Py_DECREF_IMMORTAL(result);
8598 cmpfunc fcmp = NULL;
8599 c = (*fcmp)(operand1, operand2);
8600 }
else if (PyInstance_Check(operand2)) {
8601 cmpfunc fcmp = type2->tp_compare;
8602 c = (*fcmp)(operand1, operand2);
8604 c = try_3way_compare(operand1, operand2);
8608 if (&PyFloat_Type == type2) {
8609 Py_uintptr_t aa = (Py_uintptr_t)operand1;
8610 Py_uintptr_t bb = (Py_uintptr_t)operand2;
8612 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8613 }
else if (operand1 == Py_None) {
8616 }
else if (operand2 == Py_None) {
8619 }
else if (PyNumber_Check(operand1)) {
8622 if (PyNumber_Check(operand2)) {
8624 Py_uintptr_t aa = (Py_uintptr_t)&PyFloat_Type;
8625 Py_uintptr_t bb = (Py_uintptr_t)type2;
8627 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8631 }
else if (PyNumber_Check(operand2)) {
8635 int s = strcmp(
"float", type2->tp_name);
8643 Py_uintptr_t aa = (Py_uintptr_t)&PyFloat_Type;
8644 Py_uintptr_t bb = (Py_uintptr_t)type2;
8646 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8651 Py_LeaveRecursiveCall();
8653 if (unlikely(c <= -2)) {
8654 return NUITKA_BOOL_EXCEPTION;
8679 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8683 bool checked_reverse_op =
false;
8686 if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8687 f = TP_RICHCOMPARE(type2);
8690 checked_reverse_op =
true;
8692 PyObject *result = (*f)(operand2, operand1, Py_LE);
8694 if (result != Py_NotImplemented) {
8695 Py_LeaveRecursiveCall();
8697 if (unlikely(result == NULL)) {
8698 return NUITKA_BOOL_EXCEPTION;
8702 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8708 Py_DECREF_IMMORTAL(result);
8712 f = PyFloat_Type.tp_richcompare;
8715 PyObject *result = (*f)(operand1, operand2, Py_GE);
8717 if (result != Py_NotImplemented) {
8718 Py_LeaveRecursiveCall();
8720 if (unlikely(result == NULL)) {
8721 return NUITKA_BOOL_EXCEPTION;
8725 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8731 Py_DECREF_IMMORTAL(result);
8734 if (checked_reverse_op ==
false) {
8735 f = TP_RICHCOMPARE(type2);
8738 PyObject *result = (*f)(operand2, operand1, Py_LE);
8740 if (result != Py_NotImplemented) {
8741 Py_LeaveRecursiveCall();
8743 if (unlikely(result == NULL)) {
8744 return NUITKA_BOOL_EXCEPTION;
8748 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8754 Py_DECREF_IMMORTAL(result);
8758 Py_LeaveRecursiveCall();
8764 bool r = operand1 == operand2;
8765 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8770 bool r = operand1 != operand2;
8771 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8776#if PYTHON_VERSION < 0x360
8777 PyErr_Format(PyExc_TypeError,
"unorderable types: float() >= %s()", type2->tp_name);
8779 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'float' and '%s'", type2->tp_name);
8781 return NUITKA_BOOL_EXCEPTION;
8786static PyObject *COMPARE_GE_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *operand2) {
8787 CHECK_OBJECT(operand1);
8788 assert(PyTuple_CheckExact(operand1));
8789 CHECK_OBJECT(operand2);
8790 assert(PyTuple_CheckExact(operand2));
8792 PyTupleObject *a = (PyTupleObject *)operand1;
8793 PyTupleObject *b = (PyTupleObject *)operand2;
8795 Py_ssize_t len_a = Py_SIZE(a);
8796 Py_ssize_t len_b = Py_SIZE(b);
8799 nuitka_bool res = NUITKA_BOOL_TRUE;
8802 for (i = 0; i < len_a && i < len_b; i++) {
8803 PyObject *aa = a->ob_item[i];
8804 PyObject *bb = b->ob_item[i];
8810 res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
8812 if (res == NUITKA_BOOL_EXCEPTION) {
8816 if (res == NUITKA_BOOL_FALSE) {
8822 if (found ==
false) {
8823 bool r = len_a >= len_b;
8826 PyObject *result = BOOL_FROM(r);
8827 Py_INCREF_IMMORTAL(result);
8831 return RICH_COMPARE_GE_OBJECT_OBJECT_OBJECT(a->ob_item[i], b->ob_item[i]);
8834PyObject *RICH_COMPARE_GE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *operand2) {
8836 if (Py_TYPE(operand1) == &PyTuple_Type) {
8837 return COMPARE_GE_OBJECT_TUPLE_TUPLE(operand1, operand2);
8840#if PYTHON_VERSION < 0x300
8841 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
8845 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
8850 PyTypeObject *type1 = Py_TYPE(operand1);
8852#if PYTHON_VERSION < 0x300
8854 if (type1 == &PyTuple_Type && !0) {
8856 richcmpfunc frich = PyTuple_Type.tp_richcompare;
8858 if (frich != NULL) {
8859 PyObject *result = (*frich)(operand1, operand2, Py_GE);
8861 if (result != Py_NotImplemented) {
8862 Py_LeaveRecursiveCall();
8867 Py_DECREF_IMMORTAL(result);
8871 cmpfunc fcmp = NULL;
8874 int c = (*fcmp)(operand1, operand2);
8875 c = adjust_tp_compare(c);
8877 Py_LeaveRecursiveCall();
8903 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
8907 PyObject *result = BOOL_FROM(r);
8908 Py_INCREF_IMMORTAL(result);
8916 if (type1 != &PyTuple_Type && 0) {
8917 f = PyTuple_Type.tp_richcompare;
8920 PyObject *result = (*f)(operand2, operand1, Py_LE);
8922 if (result != Py_NotImplemented) {
8923 Py_LeaveRecursiveCall();
8928 Py_DECREF_IMMORTAL(result);
8932 f = TP_RICHCOMPARE(type1);
8934 PyObject *result = (*f)(operand1, operand2, Py_GE);
8936 if (result != Py_NotImplemented) {
8937 Py_LeaveRecursiveCall();
8942 Py_DECREF_IMMORTAL(result);
8945 f = PyTuple_Type.tp_richcompare;
8947 PyObject *result = (*f)(operand2, operand1, Py_LE);
8949 if (result != Py_NotImplemented) {
8950 Py_LeaveRecursiveCall();
8955 Py_DECREF_IMMORTAL(result);
8960 if (PyInstance_Check(operand1)) {
8961 cmpfunc fcmp = type1->tp_compare;
8962 c = (*fcmp)(operand1, operand2);
8964 cmpfunc fcmp = NULL;
8965 c = (*fcmp)(operand1, operand2);
8967 c = try_3way_compare(operand1, operand2);
8971 if (type1 == &PyTuple_Type) {
8972 Py_uintptr_t aa = (Py_uintptr_t)operand1;
8973 Py_uintptr_t bb = (Py_uintptr_t)operand2;
8975 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8976 }
else if (operand1 == Py_None) {
8979 }
else if (operand2 == Py_None) {
8982 }
else if (PyNumber_Check(operand1)) {
8985 if (PyNumber_Check(operand2)) {
8987 Py_uintptr_t aa = (Py_uintptr_t)type1;
8988 Py_uintptr_t bb = (Py_uintptr_t)&PyTuple_Type;
8990 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8994 }
else if (PyNumber_Check(operand2)) {
8998 int s = strcmp(type1->tp_name,
"tuple");
9006 Py_uintptr_t aa = (Py_uintptr_t)type1;
9007 Py_uintptr_t bb = (Py_uintptr_t)&PyTuple_Type;
9009 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9014 Py_LeaveRecursiveCall();
9016 if (unlikely(c <= -2)) {
9042 PyObject *result = BOOL_FROM(r);
9043 Py_INCREF_IMMORTAL(result);
9046 bool checked_reverse_op =
false;
9049 if (type1 != &PyTuple_Type && Nuitka_Type_IsSubtype(&PyTuple_Type, type1)) {
9050 f = PyTuple_Type.tp_richcompare;
9053 checked_reverse_op =
true;
9055 PyObject *result = (*f)(operand2, operand1, Py_LE);
9057 if (result != Py_NotImplemented) {
9058 Py_LeaveRecursiveCall();
9063 Py_DECREF_IMMORTAL(result);
9067 f = TP_RICHCOMPARE(type1);
9070 PyObject *result = (*f)(operand1, operand2, Py_GE);
9072 if (result != Py_NotImplemented) {
9073 Py_LeaveRecursiveCall();
9078 Py_DECREF_IMMORTAL(result);
9081 if (checked_reverse_op ==
false) {
9082 f = PyTuple_Type.tp_richcompare;
9085 PyObject *result = (*f)(operand2, operand1, Py_LE);
9087 if (result != Py_NotImplemented) {
9088 Py_LeaveRecursiveCall();
9093 Py_DECREF_IMMORTAL(result);
9097 Py_LeaveRecursiveCall();
9103 bool r = operand1 == operand2;
9104 PyObject *result = BOOL_FROM(r);
9105 Py_INCREF_IMMORTAL(result);
9109 bool r = operand1 != operand2;
9110 PyObject *result = BOOL_FROM(r);
9111 Py_INCREF_IMMORTAL(result);
9115#if PYTHON_VERSION < 0x360
9116 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= tuple()", type1->tp_name);
9118 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'tuple'", type1->tp_name);
9126PyObject *RICH_COMPARE_GE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *operand2) {
9128 if (&PyTuple_Type == Py_TYPE(operand2)) {
9129 return COMPARE_GE_OBJECT_TUPLE_TUPLE(operand1, operand2);
9132#if PYTHON_VERSION < 0x300
9133 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
9137 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
9142 PyTypeObject *type2 = Py_TYPE(operand2);
9144#if PYTHON_VERSION < 0x300
9146 if (&PyTuple_Type == type2 && !0) {
9148 richcmpfunc frich = PyTuple_Type.tp_richcompare;
9150 if (frich != NULL) {
9151 PyObject *result = (*frich)(operand1, operand2, Py_GE);
9153 if (result != Py_NotImplemented) {
9154 Py_LeaveRecursiveCall();
9159 Py_DECREF_IMMORTAL(result);
9163 cmpfunc fcmp = NULL;
9166 int c = (*fcmp)(operand1, operand2);
9167 c = adjust_tp_compare(c);
9169 Py_LeaveRecursiveCall();
9195 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
9199 PyObject *result = BOOL_FROM(r);
9200 Py_INCREF_IMMORTAL(result);
9208 if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9209 f = TP_RICHCOMPARE(type2);
9212 PyObject *result = (*f)(operand2, operand1, Py_LE);
9214 if (result != Py_NotImplemented) {
9215 Py_LeaveRecursiveCall();
9220 Py_DECREF_IMMORTAL(result);
9224 f = PyTuple_Type.tp_richcompare;
9226 PyObject *result = (*f)(operand1, operand2, Py_GE);
9228 if (result != Py_NotImplemented) {
9229 Py_LeaveRecursiveCall();
9234 Py_DECREF_IMMORTAL(result);
9237 f = TP_RICHCOMPARE(type2);
9239 PyObject *result = (*f)(operand2, operand1, Py_LE);
9241 if (result != Py_NotImplemented) {
9242 Py_LeaveRecursiveCall();
9247 Py_DECREF_IMMORTAL(result);
9253 cmpfunc fcmp = NULL;
9254 c = (*fcmp)(operand1, operand2);
9255 }
else if (PyInstance_Check(operand2)) {
9256 cmpfunc fcmp = type2->tp_compare;
9257 c = (*fcmp)(operand1, operand2);
9259 c = try_3way_compare(operand1, operand2);
9263 if (&PyTuple_Type == type2) {
9264 Py_uintptr_t aa = (Py_uintptr_t)operand1;
9265 Py_uintptr_t bb = (Py_uintptr_t)operand2;
9267 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9268 }
else if (operand1 == Py_None) {
9271 }
else if (operand2 == Py_None) {
9274 }
else if (PyNumber_Check(operand1)) {
9277 if (PyNumber_Check(operand2)) {
9279 Py_uintptr_t aa = (Py_uintptr_t)&PyTuple_Type;
9280 Py_uintptr_t bb = (Py_uintptr_t)type2;
9282 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9286 }
else if (PyNumber_Check(operand2)) {
9290 int s = strcmp(
"tuple", type2->tp_name);
9298 Py_uintptr_t aa = (Py_uintptr_t)&PyTuple_Type;
9299 Py_uintptr_t bb = (Py_uintptr_t)type2;
9301 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9306 Py_LeaveRecursiveCall();
9308 if (unlikely(c <= -2)) {
9334 PyObject *result = BOOL_FROM(r);
9335 Py_INCREF_IMMORTAL(result);
9338 bool checked_reverse_op =
false;
9341 if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9342 f = TP_RICHCOMPARE(type2);
9345 checked_reverse_op =
true;
9347 PyObject *result = (*f)(operand2, operand1, Py_LE);
9349 if (result != Py_NotImplemented) {
9350 Py_LeaveRecursiveCall();
9355 Py_DECREF_IMMORTAL(result);
9359 f = PyTuple_Type.tp_richcompare;
9362 PyObject *result = (*f)(operand1, operand2, Py_GE);
9364 if (result != Py_NotImplemented) {
9365 Py_LeaveRecursiveCall();
9370 Py_DECREF_IMMORTAL(result);
9373 if (checked_reverse_op ==
false) {
9374 f = TP_RICHCOMPARE(type2);
9377 PyObject *result = (*f)(operand2, operand1, Py_LE);
9379 if (result != Py_NotImplemented) {
9380 Py_LeaveRecursiveCall();
9385 Py_DECREF_IMMORTAL(result);
9389 Py_LeaveRecursiveCall();
9395 bool r = operand1 == operand2;
9396 PyObject *result = BOOL_FROM(r);
9397 Py_INCREF_IMMORTAL(result);
9401 bool r = operand1 != operand2;
9402 PyObject *result = BOOL_FROM(r);
9403 Py_INCREF_IMMORTAL(result);
9407#if PYTHON_VERSION < 0x360
9408 PyErr_Format(PyExc_TypeError,
"unorderable types: tuple() >= %s()", type2->tp_name);
9410 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'tuple' and '%s'", type2->tp_name);
9418PyObject *RICH_COMPARE_GE_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *operand2) {
9420 return COMPARE_GE_OBJECT_TUPLE_TUPLE(operand1, operand2);
9423static nuitka_bool COMPARE_GE_NBOOL_TUPLE_TUPLE(PyObject *operand1, PyObject *operand2) {
9424 CHECK_OBJECT(operand1);
9425 assert(PyTuple_CheckExact(operand1));
9426 CHECK_OBJECT(operand2);
9427 assert(PyTuple_CheckExact(operand2));
9429 PyTupleObject *a = (PyTupleObject *)operand1;
9430 PyTupleObject *b = (PyTupleObject *)operand2;
9432 Py_ssize_t len_a = Py_SIZE(a);
9433 Py_ssize_t len_b = Py_SIZE(b);
9436 nuitka_bool res = NUITKA_BOOL_TRUE;
9439 for (i = 0; i < len_a && i < len_b; i++) {
9440 PyObject *aa = a->ob_item[i];
9441 PyObject *bb = b->ob_item[i];
9447 res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
9449 if (res == NUITKA_BOOL_EXCEPTION) {
9450 return NUITKA_BOOL_EXCEPTION;
9453 if (res == NUITKA_BOOL_FALSE) {
9459 if (found ==
false) {
9460 bool r = len_a >= len_b;
9463 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9468 return RICH_COMPARE_GE_NBOOL_OBJECT_OBJECT(a->ob_item[i], b->ob_item[i]);
9471nuitka_bool RICH_COMPARE_GE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *operand2) {
9473 if (Py_TYPE(operand1) == &PyTuple_Type) {
9474 return COMPARE_GE_NBOOL_TUPLE_TUPLE(operand1, operand2);
9477#if PYTHON_VERSION < 0x300
9478 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
9479 return NUITKA_BOOL_EXCEPTION;
9482 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
9483 return NUITKA_BOOL_EXCEPTION;
9487 PyTypeObject *type1 = Py_TYPE(operand1);
9489#if PYTHON_VERSION < 0x300
9491 if (type1 == &PyTuple_Type && !0) {
9493 richcmpfunc frich = PyTuple_Type.tp_richcompare;
9495 if (frich != NULL) {
9496 PyObject *result = (*frich)(operand1, operand2, Py_GE);
9498 if (result != Py_NotImplemented) {
9499 Py_LeaveRecursiveCall();
9501 if (unlikely(result == NULL)) {
9502 return NUITKA_BOOL_EXCEPTION;
9506 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9512 Py_DECREF_IMMORTAL(result);
9516 cmpfunc fcmp = NULL;
9519 int c = (*fcmp)(operand1, operand2);
9520 c = adjust_tp_compare(c);
9522 Py_LeaveRecursiveCall();
9525 return NUITKA_BOOL_EXCEPTION;
9548 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
9552 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9561 if (type1 != &PyTuple_Type && 0) {
9562 f = PyTuple_Type.tp_richcompare;
9565 PyObject *result = (*f)(operand2, operand1, Py_LE);
9567 if (result != Py_NotImplemented) {
9568 Py_LeaveRecursiveCall();
9570 if (unlikely(result == NULL)) {
9571 return NUITKA_BOOL_EXCEPTION;
9575 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9581 Py_DECREF_IMMORTAL(result);
9585 f = TP_RICHCOMPARE(type1);
9587 PyObject *result = (*f)(operand1, operand2, Py_GE);
9589 if (result != Py_NotImplemented) {
9590 Py_LeaveRecursiveCall();
9592 if (unlikely(result == NULL)) {
9593 return NUITKA_BOOL_EXCEPTION;
9597 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9603 Py_DECREF_IMMORTAL(result);
9606 f = PyTuple_Type.tp_richcompare;
9608 PyObject *result = (*f)(operand2, operand1, Py_LE);
9610 if (result != Py_NotImplemented) {
9611 Py_LeaveRecursiveCall();
9613 if (unlikely(result == NULL)) {
9614 return NUITKA_BOOL_EXCEPTION;
9618 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9624 Py_DECREF_IMMORTAL(result);
9629 if (PyInstance_Check(operand1)) {
9630 cmpfunc fcmp = type1->tp_compare;
9631 c = (*fcmp)(operand1, operand2);
9633 cmpfunc fcmp = NULL;
9634 c = (*fcmp)(operand1, operand2);
9636 c = try_3way_compare(operand1, operand2);
9640 if (type1 == &PyTuple_Type) {
9641 Py_uintptr_t aa = (Py_uintptr_t)operand1;
9642 Py_uintptr_t bb = (Py_uintptr_t)operand2;
9644 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9645 }
else if (operand1 == Py_None) {
9648 }
else if (operand2 == Py_None) {
9651 }
else if (PyNumber_Check(operand1)) {
9654 if (PyNumber_Check(operand2)) {
9656 Py_uintptr_t aa = (Py_uintptr_t)type1;
9657 Py_uintptr_t bb = (Py_uintptr_t)&PyTuple_Type;
9659 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9663 }
else if (PyNumber_Check(operand2)) {
9667 int s = strcmp(type1->tp_name,
"tuple");
9675 Py_uintptr_t aa = (Py_uintptr_t)type1;
9676 Py_uintptr_t bb = (Py_uintptr_t)&PyTuple_Type;
9678 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9683 Py_LeaveRecursiveCall();
9685 if (unlikely(c <= -2)) {
9686 return NUITKA_BOOL_EXCEPTION;
9711 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9715 bool checked_reverse_op =
false;
9718 if (type1 != &PyTuple_Type && Nuitka_Type_IsSubtype(&PyTuple_Type, type1)) {
9719 f = PyTuple_Type.tp_richcompare;
9722 checked_reverse_op =
true;
9724 PyObject *result = (*f)(operand2, operand1, Py_LE);
9726 if (result != Py_NotImplemented) {
9727 Py_LeaveRecursiveCall();
9729 if (unlikely(result == NULL)) {
9730 return NUITKA_BOOL_EXCEPTION;
9734 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9740 Py_DECREF_IMMORTAL(result);
9744 f = TP_RICHCOMPARE(type1);
9747 PyObject *result = (*f)(operand1, operand2, Py_GE);
9749 if (result != Py_NotImplemented) {
9750 Py_LeaveRecursiveCall();
9752 if (unlikely(result == NULL)) {
9753 return NUITKA_BOOL_EXCEPTION;
9757 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9763 Py_DECREF_IMMORTAL(result);
9766 if (checked_reverse_op ==
false) {
9767 f = PyTuple_Type.tp_richcompare;
9770 PyObject *result = (*f)(operand2, operand1, Py_LE);
9772 if (result != Py_NotImplemented) {
9773 Py_LeaveRecursiveCall();
9775 if (unlikely(result == NULL)) {
9776 return NUITKA_BOOL_EXCEPTION;
9780 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9786 Py_DECREF_IMMORTAL(result);
9790 Py_LeaveRecursiveCall();
9796 bool r = operand1 == operand2;
9797 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9802 bool r = operand1 != operand2;
9803 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9808#if PYTHON_VERSION < 0x360
9809 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= tuple()", type1->tp_name);
9811 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'tuple'", type1->tp_name);
9813 return NUITKA_BOOL_EXCEPTION;
9819nuitka_bool RICH_COMPARE_GE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *operand2) {
9821 if (&PyTuple_Type == Py_TYPE(operand2)) {
9822 return COMPARE_GE_NBOOL_TUPLE_TUPLE(operand1, operand2);
9825#if PYTHON_VERSION < 0x300
9826 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
9827 return NUITKA_BOOL_EXCEPTION;
9830 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
9831 return NUITKA_BOOL_EXCEPTION;
9835 PyTypeObject *type2 = Py_TYPE(operand2);
9837#if PYTHON_VERSION < 0x300
9839 if (&PyTuple_Type == type2 && !0) {
9841 richcmpfunc frich = PyTuple_Type.tp_richcompare;
9843 if (frich != NULL) {
9844 PyObject *result = (*frich)(operand1, operand2, Py_GE);
9846 if (result != Py_NotImplemented) {
9847 Py_LeaveRecursiveCall();
9849 if (unlikely(result == NULL)) {
9850 return NUITKA_BOOL_EXCEPTION;
9854 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9860 Py_DECREF_IMMORTAL(result);
9864 cmpfunc fcmp = NULL;
9867 int c = (*fcmp)(operand1, operand2);
9868 c = adjust_tp_compare(c);
9870 Py_LeaveRecursiveCall();
9873 return NUITKA_BOOL_EXCEPTION;
9896 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
9900 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9909 if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9910 f = TP_RICHCOMPARE(type2);
9913 PyObject *result = (*f)(operand2, operand1, Py_LE);
9915 if (result != Py_NotImplemented) {
9916 Py_LeaveRecursiveCall();
9918 if (unlikely(result == NULL)) {
9919 return NUITKA_BOOL_EXCEPTION;
9923 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9929 Py_DECREF_IMMORTAL(result);
9933 f = PyTuple_Type.tp_richcompare;
9935 PyObject *result = (*f)(operand1, operand2, Py_GE);
9937 if (result != Py_NotImplemented) {
9938 Py_LeaveRecursiveCall();
9940 if (unlikely(result == NULL)) {
9941 return NUITKA_BOOL_EXCEPTION;
9945 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9951 Py_DECREF_IMMORTAL(result);
9954 f = TP_RICHCOMPARE(type2);
9956 PyObject *result = (*f)(operand2, operand1, Py_LE);
9958 if (result != Py_NotImplemented) {
9959 Py_LeaveRecursiveCall();
9961 if (unlikely(result == NULL)) {
9962 return NUITKA_BOOL_EXCEPTION;
9966 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9972 Py_DECREF_IMMORTAL(result);
9978 cmpfunc fcmp = NULL;
9979 c = (*fcmp)(operand1, operand2);
9980 }
else if (PyInstance_Check(operand2)) {
9981 cmpfunc fcmp = type2->tp_compare;
9982 c = (*fcmp)(operand1, operand2);
9984 c = try_3way_compare(operand1, operand2);
9988 if (&PyTuple_Type == type2) {
9989 Py_uintptr_t aa = (Py_uintptr_t)operand1;
9990 Py_uintptr_t bb = (Py_uintptr_t)operand2;
9992 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9993 }
else if (operand1 == Py_None) {
9996 }
else if (operand2 == Py_None) {
9999 }
else if (PyNumber_Check(operand1)) {
10002 if (PyNumber_Check(operand2)) {
10004 Py_uintptr_t aa = (Py_uintptr_t)&PyTuple_Type;
10005 Py_uintptr_t bb = (Py_uintptr_t)type2;
10007 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10011 }
else if (PyNumber_Check(operand2)) {
10015 int s = strcmp(
"tuple", type2->tp_name);
10019 }
else if (s > 0) {
10023 Py_uintptr_t aa = (Py_uintptr_t)&PyTuple_Type;
10024 Py_uintptr_t bb = (Py_uintptr_t)type2;
10026 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10031 Py_LeaveRecursiveCall();
10033 if (unlikely(c <= -2)) {
10034 return NUITKA_BOOL_EXCEPTION;
10059 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10063 bool checked_reverse_op =
false;
10066 if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
10067 f = TP_RICHCOMPARE(type2);
10070 checked_reverse_op =
true;
10072 PyObject *result = (*f)(operand2, operand1, Py_LE);
10074 if (result != Py_NotImplemented) {
10075 Py_LeaveRecursiveCall();
10077 if (unlikely(result == NULL)) {
10078 return NUITKA_BOOL_EXCEPTION;
10082 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10088 Py_DECREF_IMMORTAL(result);
10092 f = PyTuple_Type.tp_richcompare;
10095 PyObject *result = (*f)(operand1, operand2, Py_GE);
10097 if (result != Py_NotImplemented) {
10098 Py_LeaveRecursiveCall();
10100 if (unlikely(result == NULL)) {
10101 return NUITKA_BOOL_EXCEPTION;
10105 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10111 Py_DECREF_IMMORTAL(result);
10114 if (checked_reverse_op ==
false) {
10115 f = TP_RICHCOMPARE(type2);
10118 PyObject *result = (*f)(operand2, operand1, Py_LE);
10120 if (result != Py_NotImplemented) {
10121 Py_LeaveRecursiveCall();
10123 if (unlikely(result == NULL)) {
10124 return NUITKA_BOOL_EXCEPTION;
10128 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10134 Py_DECREF_IMMORTAL(result);
10138 Py_LeaveRecursiveCall();
10144 bool r = operand1 == operand2;
10145 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10150 bool r = operand1 != operand2;
10151 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10156#if PYTHON_VERSION < 0x360
10157 PyErr_Format(PyExc_TypeError,
"unorderable types: tuple() >= %s()", type2->tp_name);
10159 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'tuple' and '%s'", type2->tp_name);
10161 return NUITKA_BOOL_EXCEPTION;
10167nuitka_bool RICH_COMPARE_GE_NBOOL_TUPLE_TUPLE(PyObject *operand1, PyObject *operand2) {
10169 return COMPARE_GE_NBOOL_TUPLE_TUPLE(operand1, operand2);
10172static PyObject *COMPARE_GE_OBJECT_LIST_LIST(PyObject *operand1, PyObject *operand2) {
10173 CHECK_OBJECT(operand1);
10174 assert(PyList_CheckExact(operand1));
10175 CHECK_OBJECT(operand2);
10176 assert(PyList_CheckExact(operand2));
10178 PyListObject *a = (PyListObject *)operand1;
10179 PyListObject *b = (PyListObject *)operand2;
10181 bool found =
false;
10182 nuitka_bool res = NUITKA_BOOL_TRUE;
10185 for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
10186 PyObject *aa = a->ob_item[i];
10187 PyObject *bb = b->ob_item[i];
10195 res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
10199 if (res == NUITKA_BOOL_EXCEPTION) {
10203 if (res == NUITKA_BOOL_FALSE) {
10209 if (found ==
false) {
10210 bool r = Py_SIZE(a) >= Py_SIZE(b);
10213 PyObject *result = BOOL_FROM(r);
10214 Py_INCREF_IMMORTAL(result);
10218 return RICH_COMPARE_GE_OBJECT_OBJECT_OBJECT(a->ob_item[i], b->ob_item[i]);
10221PyObject *RICH_COMPARE_GE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *operand2) {
10223 if (Py_TYPE(operand1) == &PyList_Type) {
10224 return COMPARE_GE_OBJECT_LIST_LIST(operand1, operand2);
10227#if PYTHON_VERSION < 0x300
10228 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
10232 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
10237 PyTypeObject *type1 = Py_TYPE(operand1);
10239#if PYTHON_VERSION < 0x300
10241 if (type1 == &PyList_Type && !0) {
10243 richcmpfunc frich = PyList_Type.tp_richcompare;
10245 if (frich != NULL) {
10246 PyObject *result = (*frich)(operand1, operand2, Py_GE);
10248 if (result != Py_NotImplemented) {
10249 Py_LeaveRecursiveCall();
10254 Py_DECREF_IMMORTAL(result);
10258 cmpfunc fcmp = NULL;
10260 if (fcmp != NULL) {
10261 int c = (*fcmp)(operand1, operand2);
10262 c = adjust_tp_compare(c);
10264 Py_LeaveRecursiveCall();
10290 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
10294 PyObject *result = BOOL_FROM(r);
10295 Py_INCREF_IMMORTAL(result);
10303 if (type1 != &PyList_Type && 0) {
10304 f = PyList_Type.tp_richcompare;
10307 PyObject *result = (*f)(operand2, operand1, Py_LE);
10309 if (result != Py_NotImplemented) {
10310 Py_LeaveRecursiveCall();
10315 Py_DECREF_IMMORTAL(result);
10319 f = TP_RICHCOMPARE(type1);
10321 PyObject *result = (*f)(operand1, operand2, Py_GE);
10323 if (result != Py_NotImplemented) {
10324 Py_LeaveRecursiveCall();
10329 Py_DECREF_IMMORTAL(result);
10332 f = PyList_Type.tp_richcompare;
10334 PyObject *result = (*f)(operand2, operand1, Py_LE);
10336 if (result != Py_NotImplemented) {
10337 Py_LeaveRecursiveCall();
10342 Py_DECREF_IMMORTAL(result);
10347 if (PyInstance_Check(operand1)) {
10348 cmpfunc fcmp = type1->tp_compare;
10349 c = (*fcmp)(operand1, operand2);
10351 cmpfunc fcmp = NULL;
10352 c = (*fcmp)(operand1, operand2);
10354 c = try_3way_compare(operand1, operand2);
10358 if (type1 == &PyList_Type) {
10359 Py_uintptr_t aa = (Py_uintptr_t)operand1;
10360 Py_uintptr_t bb = (Py_uintptr_t)operand2;
10362 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10363 }
else if (operand1 == Py_None) {
10366 }
else if (operand2 == Py_None) {
10369 }
else if (PyNumber_Check(operand1)) {
10372 if (PyNumber_Check(operand2)) {
10374 Py_uintptr_t aa = (Py_uintptr_t)type1;
10375 Py_uintptr_t bb = (Py_uintptr_t)&PyList_Type;
10377 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10381 }
else if (PyNumber_Check(operand2)) {
10385 int s = strcmp(type1->tp_name,
"list");
10389 }
else if (s > 0) {
10393 Py_uintptr_t aa = (Py_uintptr_t)type1;
10394 Py_uintptr_t bb = (Py_uintptr_t)&PyList_Type;
10396 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10401 Py_LeaveRecursiveCall();
10403 if (unlikely(c <= -2)) {
10429 PyObject *result = BOOL_FROM(r);
10430 Py_INCREF_IMMORTAL(result);
10433 bool checked_reverse_op =
false;
10436 if (type1 != &PyList_Type && Nuitka_Type_IsSubtype(&PyList_Type, type1)) {
10437 f = PyList_Type.tp_richcompare;
10440 checked_reverse_op =
true;
10442 PyObject *result = (*f)(operand2, operand1, Py_LE);
10444 if (result != Py_NotImplemented) {
10445 Py_LeaveRecursiveCall();
10450 Py_DECREF_IMMORTAL(result);
10454 f = TP_RICHCOMPARE(type1);
10457 PyObject *result = (*f)(operand1, operand2, Py_GE);
10459 if (result != Py_NotImplemented) {
10460 Py_LeaveRecursiveCall();
10465 Py_DECREF_IMMORTAL(result);
10468 if (checked_reverse_op ==
false) {
10469 f = PyList_Type.tp_richcompare;
10472 PyObject *result = (*f)(operand2, operand1, Py_LE);
10474 if (result != Py_NotImplemented) {
10475 Py_LeaveRecursiveCall();
10480 Py_DECREF_IMMORTAL(result);
10484 Py_LeaveRecursiveCall();
10490 bool r = operand1 == operand2;
10491 PyObject *result = BOOL_FROM(r);
10492 Py_INCREF_IMMORTAL(result);
10496 bool r = operand1 != operand2;
10497 PyObject *result = BOOL_FROM(r);
10498 Py_INCREF_IMMORTAL(result);
10502#if PYTHON_VERSION < 0x360
10503 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= list()", type1->tp_name);
10505 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'list'", type1->tp_name);
10513PyObject *RICH_COMPARE_GE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *operand2) {
10515 if (&PyList_Type == Py_TYPE(operand2)) {
10516 return COMPARE_GE_OBJECT_LIST_LIST(operand1, operand2);
10519#if PYTHON_VERSION < 0x300
10520 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
10524 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
10529 PyTypeObject *type2 = Py_TYPE(operand2);
10531#if PYTHON_VERSION < 0x300
10533 if (&PyList_Type == type2 && !0) {
10535 richcmpfunc frich = PyList_Type.tp_richcompare;
10537 if (frich != NULL) {
10538 PyObject *result = (*frich)(operand1, operand2, Py_GE);
10540 if (result != Py_NotImplemented) {
10541 Py_LeaveRecursiveCall();
10546 Py_DECREF_IMMORTAL(result);
10550 cmpfunc fcmp = NULL;
10552 if (fcmp != NULL) {
10553 int c = (*fcmp)(operand1, operand2);
10554 c = adjust_tp_compare(c);
10556 Py_LeaveRecursiveCall();
10582 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
10586 PyObject *result = BOOL_FROM(r);
10587 Py_INCREF_IMMORTAL(result);
10595 if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10596 f = TP_RICHCOMPARE(type2);
10599 PyObject *result = (*f)(operand2, operand1, Py_LE);
10601 if (result != Py_NotImplemented) {
10602 Py_LeaveRecursiveCall();
10607 Py_DECREF_IMMORTAL(result);
10611 f = PyList_Type.tp_richcompare;
10613 PyObject *result = (*f)(operand1, operand2, Py_GE);
10615 if (result != Py_NotImplemented) {
10616 Py_LeaveRecursiveCall();
10621 Py_DECREF_IMMORTAL(result);
10624 f = TP_RICHCOMPARE(type2);
10626 PyObject *result = (*f)(operand2, operand1, Py_LE);
10628 if (result != Py_NotImplemented) {
10629 Py_LeaveRecursiveCall();
10634 Py_DECREF_IMMORTAL(result);
10640 cmpfunc fcmp = NULL;
10641 c = (*fcmp)(operand1, operand2);
10642 }
else if (PyInstance_Check(operand2)) {
10643 cmpfunc fcmp = type2->tp_compare;
10644 c = (*fcmp)(operand1, operand2);
10646 c = try_3way_compare(operand1, operand2);
10650 if (&PyList_Type == type2) {
10651 Py_uintptr_t aa = (Py_uintptr_t)operand1;
10652 Py_uintptr_t bb = (Py_uintptr_t)operand2;
10654 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10655 }
else if (operand1 == Py_None) {
10658 }
else if (operand2 == Py_None) {
10661 }
else if (PyNumber_Check(operand1)) {
10664 if (PyNumber_Check(operand2)) {
10666 Py_uintptr_t aa = (Py_uintptr_t)&PyList_Type;
10667 Py_uintptr_t bb = (Py_uintptr_t)type2;
10669 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10673 }
else if (PyNumber_Check(operand2)) {
10677 int s = strcmp(
"list", type2->tp_name);
10681 }
else if (s > 0) {
10685 Py_uintptr_t aa = (Py_uintptr_t)&PyList_Type;
10686 Py_uintptr_t bb = (Py_uintptr_t)type2;
10688 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10693 Py_LeaveRecursiveCall();
10695 if (unlikely(c <= -2)) {
10721 PyObject *result = BOOL_FROM(r);
10722 Py_INCREF_IMMORTAL(result);
10725 bool checked_reverse_op =
false;
10728 if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10729 f = TP_RICHCOMPARE(type2);
10732 checked_reverse_op =
true;
10734 PyObject *result = (*f)(operand2, operand1, Py_LE);
10736 if (result != Py_NotImplemented) {
10737 Py_LeaveRecursiveCall();
10742 Py_DECREF_IMMORTAL(result);
10746 f = PyList_Type.tp_richcompare;
10749 PyObject *result = (*f)(operand1, operand2, Py_GE);
10751 if (result != Py_NotImplemented) {
10752 Py_LeaveRecursiveCall();
10757 Py_DECREF_IMMORTAL(result);
10760 if (checked_reverse_op ==
false) {
10761 f = TP_RICHCOMPARE(type2);
10764 PyObject *result = (*f)(operand2, operand1, Py_LE);
10766 if (result != Py_NotImplemented) {
10767 Py_LeaveRecursiveCall();
10772 Py_DECREF_IMMORTAL(result);
10776 Py_LeaveRecursiveCall();
10782 bool r = operand1 == operand2;
10783 PyObject *result = BOOL_FROM(r);
10784 Py_INCREF_IMMORTAL(result);
10788 bool r = operand1 != operand2;
10789 PyObject *result = BOOL_FROM(r);
10790 Py_INCREF_IMMORTAL(result);
10794#if PYTHON_VERSION < 0x360
10795 PyErr_Format(PyExc_TypeError,
"unorderable types: list() >= %s()", type2->tp_name);
10797 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'list' and '%s'", type2->tp_name);
10805PyObject *RICH_COMPARE_GE_OBJECT_LIST_LIST(PyObject *operand1, PyObject *operand2) {
10807 return COMPARE_GE_OBJECT_LIST_LIST(operand1, operand2);
10810static nuitka_bool COMPARE_GE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *operand2) {
10811 CHECK_OBJECT(operand1);
10812 assert(PyList_CheckExact(operand1));
10813 CHECK_OBJECT(operand2);
10814 assert(PyList_CheckExact(operand2));
10816 PyListObject *a = (PyListObject *)operand1;
10817 PyListObject *b = (PyListObject *)operand2;
10819 bool found =
false;
10820 nuitka_bool res = NUITKA_BOOL_TRUE;
10823 for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
10824 PyObject *aa = a->ob_item[i];
10825 PyObject *bb = b->ob_item[i];
10833 res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
10837 if (res == NUITKA_BOOL_EXCEPTION) {
10838 return NUITKA_BOOL_EXCEPTION;
10841 if (res == NUITKA_BOOL_FALSE) {
10847 if (found ==
false) {
10848 bool r = Py_SIZE(a) >= Py_SIZE(b);
10851 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10856 return RICH_COMPARE_GE_NBOOL_OBJECT_OBJECT(a->ob_item[i], b->ob_item[i]);
10859nuitka_bool RICH_COMPARE_GE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *operand2) {
10861 if (Py_TYPE(operand1) == &PyList_Type) {
10862 return COMPARE_GE_NBOOL_LIST_LIST(operand1, operand2);
10865#if PYTHON_VERSION < 0x300
10866 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
10867 return NUITKA_BOOL_EXCEPTION;
10870 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
10871 return NUITKA_BOOL_EXCEPTION;
10875 PyTypeObject *type1 = Py_TYPE(operand1);
10877#if PYTHON_VERSION < 0x300
10879 if (type1 == &PyList_Type && !0) {
10881 richcmpfunc frich = PyList_Type.tp_richcompare;
10883 if (frich != NULL) {
10884 PyObject *result = (*frich)(operand1, operand2, Py_GE);
10886 if (result != Py_NotImplemented) {
10887 Py_LeaveRecursiveCall();
10889 if (unlikely(result == NULL)) {
10890 return NUITKA_BOOL_EXCEPTION;
10894 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10900 Py_DECREF_IMMORTAL(result);
10904 cmpfunc fcmp = NULL;
10906 if (fcmp != NULL) {
10907 int c = (*fcmp)(operand1, operand2);
10908 c = adjust_tp_compare(c);
10910 Py_LeaveRecursiveCall();
10913 return NUITKA_BOOL_EXCEPTION;
10936 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
10940 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10949 if (type1 != &PyList_Type && 0) {
10950 f = PyList_Type.tp_richcompare;
10953 PyObject *result = (*f)(operand2, operand1, Py_LE);
10955 if (result != Py_NotImplemented) {
10956 Py_LeaveRecursiveCall();
10958 if (unlikely(result == NULL)) {
10959 return NUITKA_BOOL_EXCEPTION;
10963 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10969 Py_DECREF_IMMORTAL(result);
10973 f = TP_RICHCOMPARE(type1);
10975 PyObject *result = (*f)(operand1, operand2, Py_GE);
10977 if (result != Py_NotImplemented) {
10978 Py_LeaveRecursiveCall();
10980 if (unlikely(result == NULL)) {
10981 return NUITKA_BOOL_EXCEPTION;
10985 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10991 Py_DECREF_IMMORTAL(result);
10994 f = PyList_Type.tp_richcompare;
10996 PyObject *result = (*f)(operand2, operand1, Py_LE);
10998 if (result != Py_NotImplemented) {
10999 Py_LeaveRecursiveCall();
11001 if (unlikely(result == NULL)) {
11002 return NUITKA_BOOL_EXCEPTION;
11006 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11012 Py_DECREF_IMMORTAL(result);
11017 if (PyInstance_Check(operand1)) {
11018 cmpfunc fcmp = type1->tp_compare;
11019 c = (*fcmp)(operand1, operand2);
11021 cmpfunc fcmp = NULL;
11022 c = (*fcmp)(operand1, operand2);
11024 c = try_3way_compare(operand1, operand2);
11028 if (type1 == &PyList_Type) {
11029 Py_uintptr_t aa = (Py_uintptr_t)operand1;
11030 Py_uintptr_t bb = (Py_uintptr_t)operand2;
11032 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11033 }
else if (operand1 == Py_None) {
11036 }
else if (operand2 == Py_None) {
11039 }
else if (PyNumber_Check(operand1)) {
11042 if (PyNumber_Check(operand2)) {
11044 Py_uintptr_t aa = (Py_uintptr_t)type1;
11045 Py_uintptr_t bb = (Py_uintptr_t)&PyList_Type;
11047 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11051 }
else if (PyNumber_Check(operand2)) {
11055 int s = strcmp(type1->tp_name,
"list");
11059 }
else if (s > 0) {
11063 Py_uintptr_t aa = (Py_uintptr_t)type1;
11064 Py_uintptr_t bb = (Py_uintptr_t)&PyList_Type;
11066 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11071 Py_LeaveRecursiveCall();
11073 if (unlikely(c <= -2)) {
11074 return NUITKA_BOOL_EXCEPTION;
11099 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11103 bool checked_reverse_op =
false;
11106 if (type1 != &PyList_Type && Nuitka_Type_IsSubtype(&PyList_Type, type1)) {
11107 f = PyList_Type.tp_richcompare;
11110 checked_reverse_op =
true;
11112 PyObject *result = (*f)(operand2, operand1, Py_LE);
11114 if (result != Py_NotImplemented) {
11115 Py_LeaveRecursiveCall();
11117 if (unlikely(result == NULL)) {
11118 return NUITKA_BOOL_EXCEPTION;
11122 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11128 Py_DECREF_IMMORTAL(result);
11132 f = TP_RICHCOMPARE(type1);
11135 PyObject *result = (*f)(operand1, operand2, Py_GE);
11137 if (result != Py_NotImplemented) {
11138 Py_LeaveRecursiveCall();
11140 if (unlikely(result == NULL)) {
11141 return NUITKA_BOOL_EXCEPTION;
11145 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11151 Py_DECREF_IMMORTAL(result);
11154 if (checked_reverse_op ==
false) {
11155 f = PyList_Type.tp_richcompare;
11158 PyObject *result = (*f)(operand2, operand1, Py_LE);
11160 if (result != Py_NotImplemented) {
11161 Py_LeaveRecursiveCall();
11163 if (unlikely(result == NULL)) {
11164 return NUITKA_BOOL_EXCEPTION;
11168 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11174 Py_DECREF_IMMORTAL(result);
11178 Py_LeaveRecursiveCall();
11184 bool r = operand1 == operand2;
11185 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11190 bool r = operand1 != operand2;
11191 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11196#if PYTHON_VERSION < 0x360
11197 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() >= list()", type1->tp_name);
11199 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of '%s' and 'list'", type1->tp_name);
11201 return NUITKA_BOOL_EXCEPTION;
11207nuitka_bool RICH_COMPARE_GE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *operand2) {
11209 if (&PyList_Type == Py_TYPE(operand2)) {
11210 return COMPARE_GE_NBOOL_LIST_LIST(operand1, operand2);
11213#if PYTHON_VERSION < 0x300
11214 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
11215 return NUITKA_BOOL_EXCEPTION;
11218 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
11219 return NUITKA_BOOL_EXCEPTION;
11223 PyTypeObject *type2 = Py_TYPE(operand2);
11225#if PYTHON_VERSION < 0x300
11227 if (&PyList_Type == type2 && !0) {
11229 richcmpfunc frich = PyList_Type.tp_richcompare;
11231 if (frich != NULL) {
11232 PyObject *result = (*frich)(operand1, operand2, Py_GE);
11234 if (result != Py_NotImplemented) {
11235 Py_LeaveRecursiveCall();
11237 if (unlikely(result == NULL)) {
11238 return NUITKA_BOOL_EXCEPTION;
11242 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11248 Py_DECREF_IMMORTAL(result);
11252 cmpfunc fcmp = NULL;
11254 if (fcmp != NULL) {
11255 int c = (*fcmp)(operand1, operand2);
11256 c = adjust_tp_compare(c);
11258 Py_LeaveRecursiveCall();
11261 return NUITKA_BOOL_EXCEPTION;
11284 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
11288 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11297 if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11298 f = TP_RICHCOMPARE(type2);
11301 PyObject *result = (*f)(operand2, operand1, Py_LE);
11303 if (result != Py_NotImplemented) {
11304 Py_LeaveRecursiveCall();
11306 if (unlikely(result == NULL)) {
11307 return NUITKA_BOOL_EXCEPTION;
11311 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11317 Py_DECREF_IMMORTAL(result);
11321 f = PyList_Type.tp_richcompare;
11323 PyObject *result = (*f)(operand1, operand2, Py_GE);
11325 if (result != Py_NotImplemented) {
11326 Py_LeaveRecursiveCall();
11328 if (unlikely(result == NULL)) {
11329 return NUITKA_BOOL_EXCEPTION;
11333 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11339 Py_DECREF_IMMORTAL(result);
11342 f = TP_RICHCOMPARE(type2);
11344 PyObject *result = (*f)(operand2, operand1, Py_LE);
11346 if (result != Py_NotImplemented) {
11347 Py_LeaveRecursiveCall();
11349 if (unlikely(result == NULL)) {
11350 return NUITKA_BOOL_EXCEPTION;
11354 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11360 Py_DECREF_IMMORTAL(result);
11366 cmpfunc fcmp = NULL;
11367 c = (*fcmp)(operand1, operand2);
11368 }
else if (PyInstance_Check(operand2)) {
11369 cmpfunc fcmp = type2->tp_compare;
11370 c = (*fcmp)(operand1, operand2);
11372 c = try_3way_compare(operand1, operand2);
11376 if (&PyList_Type == type2) {
11377 Py_uintptr_t aa = (Py_uintptr_t)operand1;
11378 Py_uintptr_t bb = (Py_uintptr_t)operand2;
11380 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11381 }
else if (operand1 == Py_None) {
11384 }
else if (operand2 == Py_None) {
11387 }
else if (PyNumber_Check(operand1)) {
11390 if (PyNumber_Check(operand2)) {
11392 Py_uintptr_t aa = (Py_uintptr_t)&PyList_Type;
11393 Py_uintptr_t bb = (Py_uintptr_t)type2;
11395 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11399 }
else if (PyNumber_Check(operand2)) {
11403 int s = strcmp(
"list", type2->tp_name);
11407 }
else if (s > 0) {
11411 Py_uintptr_t aa = (Py_uintptr_t)&PyList_Type;
11412 Py_uintptr_t bb = (Py_uintptr_t)type2;
11414 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11419 Py_LeaveRecursiveCall();
11421 if (unlikely(c <= -2)) {
11422 return NUITKA_BOOL_EXCEPTION;
11447 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11451 bool checked_reverse_op =
false;
11454 if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11455 f = TP_RICHCOMPARE(type2);
11458 checked_reverse_op =
true;
11460 PyObject *result = (*f)(operand2, operand1, Py_LE);
11462 if (result != Py_NotImplemented) {
11463 Py_LeaveRecursiveCall();
11465 if (unlikely(result == NULL)) {
11466 return NUITKA_BOOL_EXCEPTION;
11470 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11476 Py_DECREF_IMMORTAL(result);
11480 f = PyList_Type.tp_richcompare;
11483 PyObject *result = (*f)(operand1, operand2, Py_GE);
11485 if (result != Py_NotImplemented) {
11486 Py_LeaveRecursiveCall();
11488 if (unlikely(result == NULL)) {
11489 return NUITKA_BOOL_EXCEPTION;
11493 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11499 Py_DECREF_IMMORTAL(result);
11502 if (checked_reverse_op ==
false) {
11503 f = TP_RICHCOMPARE(type2);
11506 PyObject *result = (*f)(operand2, operand1, Py_LE);
11508 if (result != Py_NotImplemented) {
11509 Py_LeaveRecursiveCall();
11511 if (unlikely(result == NULL)) {
11512 return NUITKA_BOOL_EXCEPTION;
11516 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11522 Py_DECREF_IMMORTAL(result);
11526 Py_LeaveRecursiveCall();
11532 bool r = operand1 == operand2;
11533 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11538 bool r = operand1 != operand2;
11539 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11544#if PYTHON_VERSION < 0x360
11545 PyErr_Format(PyExc_TypeError,
"unorderable types: list() >= %s()", type2->tp_name);
11547 PyErr_Format(PyExc_TypeError,
"'>=' not supported between instances of 'list' and '%s'", type2->tp_name);
11549 return NUITKA_BOOL_EXCEPTION;
11555nuitka_bool RICH_COMPARE_GE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *operand2) {
11557 return COMPARE_GE_NBOOL_LIST_LIST(operand1, operand2);
11560static PyObject *COMPARE_GE_OBJECT_LONG_CLONG(PyObject *operand1,
long operand2) {
11561 CHECK_OBJECT(operand1);
11562 assert(PyLong_CheckExact(operand1));
11564 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
11566 bool operand2_is_negative;
11567 unsigned long operand2_abs_ival;
11569 if (operand2 < 0) {
11570 operand2_abs_ival = (
unsigned long)(-1 - operand2) + 1;
11571 operand2_is_negative =
true;
11573 operand2_abs_ival = (
unsigned long)operand2;
11574 operand2_is_negative =
false;
11577 Py_ssize_t operand2_digit_count = 0;
11578 digit operand2_digits[5] = {0};
11580 unsigned long t = operand2_abs_ival;
11583 operand2_digit_count += 1;
11584 assert(operand2_digit_count <= (Py_ssize_t)(
sizeof(operand2_digit_count) /
sizeof(digit)));
11586 operand2_digits[operand2_digit_count] = (digit)(t & PyLong_MASK);
11587 t >>= PyLong_SHIFT;
11591 NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
11592 operand2_is_negative ==
false ? operand2_digit_count : -operand2_digit_count;
11596 if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11597 r = Nuitka_LongGetSignedDigitSize(operand1_long_object) - operand2_size > 0;
11599 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11602 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11603 r = Nuitka_LongGetDigitPointer(operand1_long_object)[i] > operand2_digits[i];
11604 if (Nuitka_LongIsNegative(operand1_long_object)) {
11613 PyObject *result = BOOL_FROM(r);
11614 Py_INCREF_IMMORTAL(result);
11617#if PYTHON_VERSION < 0x300
11619PyObject *RICH_COMPARE_GE_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
11621 return COMPARE_GE_OBJECT_LONG_CLONG(operand1, PyInt_AS_LONG(operand1));
11625static bool COMPARE_GE_CBOOL_LONG_CLONG(PyObject *operand1,
long operand2) {
11626 CHECK_OBJECT(operand1);
11627 assert(PyLong_CheckExact(operand1));
11629 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
11631 bool operand2_is_negative;
11632 unsigned long operand2_abs_ival;
11634 if (operand2 < 0) {
11635 operand2_abs_ival = (
unsigned long)(-1 - operand2) + 1;
11636 operand2_is_negative =
true;
11638 operand2_abs_ival = (
unsigned long)operand2;
11639 operand2_is_negative =
false;
11642 Py_ssize_t operand2_digit_count = 0;
11643 digit operand2_digits[5] = {0};
11645 unsigned long t = operand2_abs_ival;
11648 operand2_digit_count += 1;
11649 assert(operand2_digit_count <= (Py_ssize_t)(
sizeof(operand2_digit_count) /
sizeof(digit)));
11651 operand2_digits[operand2_digit_count] = (digit)(t & PyLong_MASK);
11652 t >>= PyLong_SHIFT;
11656 NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
11657 operand2_is_negative ==
false ? operand2_digit_count : -operand2_digit_count;
11661 if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11662 r = Nuitka_LongGetSignedDigitSize(operand1_long_object) - operand2_size > 0;
11664 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11667 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11668 r = Nuitka_LongGetDigitPointer(operand1_long_object)[i] > operand2_digits[i];
11669 if (Nuitka_LongIsNegative(operand1_long_object)) {
11682#if PYTHON_VERSION < 0x300
11684bool RICH_COMPARE_GE_CBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
11686 return COMPARE_GE_CBOOL_LONG_CLONG(operand1, PyInt_AS_LONG(operand1));
11690#if PYTHON_VERSION < 0x300
11691static PyObject *COMPARE_GE_OBJECT_INT_CLONG(PyObject *operand1,
long operand2) {
11692 CHECK_OBJECT(operand1);
11693 assert(PyInt_CheckExact(operand1));
11695 const long a = PyInt_AS_LONG(operand1);
11696 const long b = operand2;
11701 PyObject *result = BOOL_FROM(r);
11702 Py_INCREF_IMMORTAL(result);
11706#if PYTHON_VERSION < 0x300
11708PyObject *RICH_COMPARE_GE_OBJECT_INT_CLONG(PyObject *operand1,
long operand2) {
11710 return COMPARE_GE_OBJECT_INT_CLONG(operand1, operand2);
11714#if PYTHON_VERSION < 0x300
11715static bool COMPARE_GE_CBOOL_INT_CLONG(PyObject *operand1,
long operand2) {
11716 CHECK_OBJECT(operand1);
11717 assert(PyInt_CheckExact(operand1));
11719 const long a = PyInt_AS_LONG(operand1);
11720 const long b = operand2;
11730#if PYTHON_VERSION < 0x300
11732bool RICH_COMPARE_GE_CBOOL_INT_CLONG(PyObject *operand1,
long operand2) {
11734 return COMPARE_GE_CBOOL_INT_CLONG(operand1, operand2);
11738static PyObject *COMPARE_GE_OBJECT_LONG_DIGIT(PyObject *operand1,
long operand2) {
11739 CHECK_OBJECT(operand1);
11740 assert(PyLong_CheckExact(operand1));
11741 assert(Py_ABS(operand2) < (1 << PyLong_SHIFT));
11743 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
11747 if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11748 (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11749 r = Nuitka_LongGetSignedDigitSize(operand1_long_object) -
11750 (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1)) >
11753 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11756 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11757 r = Nuitka_LongGetDigitPointer(operand1_long_object)[i] > (digit)Py_ABS(operand2);
11758 if (Nuitka_LongIsNegative(operand1_long_object)) {
11767 PyObject *result = BOOL_FROM(r);
11768 Py_INCREF_IMMORTAL(result);
11773PyObject *RICH_COMPARE_GE_OBJECT_LONG_DIGIT(PyObject *operand1,
long operand2) {
11775 return COMPARE_GE_OBJECT_LONG_DIGIT(operand1, operand2);
11778static bool COMPARE_GE_CBOOL_LONG_DIGIT(PyObject *operand1,
long operand2) {
11779 CHECK_OBJECT(operand1);
11780 assert(PyLong_CheckExact(operand1));
11781 assert(Py_ABS(operand2) < (1 << PyLong_SHIFT));
11783 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
11787 if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11788 (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11789 r = Nuitka_LongGetSignedDigitSize(operand1_long_object) -
11790 (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1)) >
11793 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11796 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11797 r = Nuitka_LongGetDigitPointer(operand1_long_object)[i] > (digit)Py_ABS(operand2);
11798 if (Nuitka_LongIsNegative(operand1_long_object)) {
11813bool RICH_COMPARE_GE_CBOOL_LONG_DIGIT(PyObject *operand1,
long operand2) {
11815 return COMPARE_GE_CBOOL_LONG_DIGIT(operand1, operand2);
11818static PyObject *COMPARE_GE_OBJECT_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
11819 CHECK_OBJECT(operand1);
11820 assert(PyFloat_CheckExact(operand1));
11822 const double a = PyFloat_AS_DOUBLE(operand1);
11823 const double b = operand2;
11828 PyObject *result = BOOL_FROM(r);
11829 Py_INCREF_IMMORTAL(result);
11833PyObject *RICH_COMPARE_GE_OBJECT_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
11835 return COMPARE_GE_OBJECT_FLOAT_CFLOAT(operand1, operand2);
11838static bool COMPARE_GE_CBOOL_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
11839 CHECK_OBJECT(operand1);
11840 assert(PyFloat_CheckExact(operand1));
11842 const double a = PyFloat_AS_DOUBLE(operand1);
11843 const double b = operand2;
11853bool RICH_COMPARE_GE_CBOOL_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
11855 return COMPARE_GE_CBOOL_FLOAT_CFLOAT(operand1, operand2);