7#include "nuitka/prelude.h"
12#if PYTHON_VERSION < 0x300
13static PyObject *COMPARE_NE_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_NE_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_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
51#if PYTHON_VERSION < 0x300
52 if (PyInt_CheckExact(operand1) && PyInt_CheckExact(operand2)) {
53 return COMPARE_NE_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_NE);
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_NE);
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_NE);
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_NE);
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_NE);
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_NE);
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_NE);
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_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
355#if PYTHON_VERSION < 0x300
356 if (PyInt_CheckExact(operand1) && PyInt_CheckExact(operand2)) {
357 return COMPARE_NE_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_NE);
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_NE);
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_NE);
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_NE);
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_NE);
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_NE);
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_NE);
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_NE_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 if (len_a != len_b) {
739 PyObject *result = BOOL_FROM(r);
740 Py_INCREF_IMMORTAL(result);
743 if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
747 PyObject *result = BOOL_FROM(r);
748 Py_INCREF_IMMORTAL(result);
754 PyObject *result = BOOL_FROM(r);
755 Py_INCREF_IMMORTAL(result);
761#if PYTHON_VERSION < 0x300
763PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
765 if (Py_TYPE(operand1) == &PyString_Type) {
766 return COMPARE_NE_OBJECT_STR_STR(operand1, operand2);
769#if PYTHON_VERSION < 0x300
770 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
774 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
779 PyTypeObject *type1 = Py_TYPE(operand1);
781#if PYTHON_VERSION < 0x300
783 if (type1 == &PyString_Type && !0) {
785 richcmpfunc frich = PyString_Type.tp_richcompare;
788 PyObject *result = (*frich)(operand1, operand2, Py_NE);
790 if (result != Py_NotImplemented) {
791 Py_LeaveRecursiveCall();
796 Py_DECREF_IMMORTAL(result);
803 int c = (*fcmp)(operand1, operand2);
804 c = adjust_tp_compare(c);
806 Py_LeaveRecursiveCall();
832 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
836 PyObject *result = BOOL_FROM(r);
837 Py_INCREF_IMMORTAL(result);
845 if (type1 != &PyString_Type && 0) {
846 f = PyString_Type.tp_richcompare;
849 PyObject *result = (*f)(operand2, operand1, Py_NE);
851 if (result != Py_NotImplemented) {
852 Py_LeaveRecursiveCall();
857 Py_DECREF_IMMORTAL(result);
861 f = TP_RICHCOMPARE(type1);
863 PyObject *result = (*f)(operand1, operand2, Py_NE);
865 if (result != Py_NotImplemented) {
866 Py_LeaveRecursiveCall();
871 Py_DECREF_IMMORTAL(result);
874 f = PyString_Type.tp_richcompare;
876 PyObject *result = (*f)(operand2, operand1, Py_NE);
878 if (result != Py_NotImplemented) {
879 Py_LeaveRecursiveCall();
884 Py_DECREF_IMMORTAL(result);
889 if (PyInstance_Check(operand1)) {
890 cmpfunc fcmp = type1->tp_compare;
891 c = (*fcmp)(operand1, operand2);
894 c = (*fcmp)(operand1, operand2);
896 c = try_3way_compare(operand1, operand2);
900 if (type1 == &PyString_Type) {
901 Py_uintptr_t aa = (Py_uintptr_t)operand1;
902 Py_uintptr_t bb = (Py_uintptr_t)operand2;
904 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
905 }
else if (operand1 == Py_None) {
908 }
else if (operand2 == Py_None) {
911 }
else if (PyNumber_Check(operand1)) {
914 if (PyNumber_Check(operand2)) {
916 Py_uintptr_t aa = (Py_uintptr_t)type1;
917 Py_uintptr_t bb = (Py_uintptr_t)&PyString_Type;
919 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
923 }
else if (PyNumber_Check(operand2)) {
927 int s = strcmp(type1->tp_name,
"str");
935 Py_uintptr_t aa = (Py_uintptr_t)type1;
936 Py_uintptr_t bb = (Py_uintptr_t)&PyString_Type;
938 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
943 Py_LeaveRecursiveCall();
945 if (unlikely(c <= -2)) {
971 PyObject *result = BOOL_FROM(r);
972 Py_INCREF_IMMORTAL(result);
975 bool checked_reverse_op =
false;
978 if (type1 != &PyString_Type && Nuitka_Type_IsSubtype(&PyString_Type, type1)) {
979 f = PyString_Type.tp_richcompare;
982 checked_reverse_op =
true;
984 PyObject *result = (*f)(operand2, operand1, Py_NE);
986 if (result != Py_NotImplemented) {
987 Py_LeaveRecursiveCall();
992 Py_DECREF_IMMORTAL(result);
996 f = TP_RICHCOMPARE(type1);
999 PyObject *result = (*f)(operand1, operand2, Py_NE);
1001 if (result != Py_NotImplemented) {
1002 Py_LeaveRecursiveCall();
1007 Py_DECREF_IMMORTAL(result);
1010 if (checked_reverse_op ==
false) {
1011 f = PyString_Type.tp_richcompare;
1014 PyObject *result = (*f)(operand2, operand1, Py_NE);
1016 if (result != Py_NotImplemented) {
1017 Py_LeaveRecursiveCall();
1022 Py_DECREF_IMMORTAL(result);
1026 Py_LeaveRecursiveCall();
1032 bool r = operand1 == operand2;
1033 PyObject *result = BOOL_FROM(r);
1034 Py_INCREF_IMMORTAL(result);
1038 bool r = operand1 != operand2;
1039 PyObject *result = BOOL_FROM(r);
1040 Py_INCREF_IMMORTAL(result);
1044#if PYTHON_VERSION < 0x360
1045 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != str()", type1->tp_name);
1047 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'str'", type1->tp_name);
1055#if PYTHON_VERSION < 0x300
1057PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operand2) {
1059 if (&PyString_Type == Py_TYPE(operand2)) {
1060 return COMPARE_NE_OBJECT_STR_STR(operand1, operand2);
1063#if PYTHON_VERSION < 0x300
1064 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
1068 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
1073 PyTypeObject *type2 = Py_TYPE(operand2);
1075#if PYTHON_VERSION < 0x300
1077 if (&PyString_Type == type2 && !0) {
1079 richcmpfunc frich = PyString_Type.tp_richcompare;
1081 if (frich != NULL) {
1082 PyObject *result = (*frich)(operand1, operand2, Py_NE);
1084 if (result != Py_NotImplemented) {
1085 Py_LeaveRecursiveCall();
1090 Py_DECREF_IMMORTAL(result);
1094 cmpfunc fcmp = NULL;
1097 int c = (*fcmp)(operand1, operand2);
1098 c = adjust_tp_compare(c);
1100 Py_LeaveRecursiveCall();
1126 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
1130 PyObject *result = BOOL_FROM(r);
1131 Py_INCREF_IMMORTAL(result);
1139 if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1140 f = TP_RICHCOMPARE(type2);
1143 PyObject *result = (*f)(operand2, operand1, Py_NE);
1145 if (result != Py_NotImplemented) {
1146 Py_LeaveRecursiveCall();
1151 Py_DECREF_IMMORTAL(result);
1155 f = PyString_Type.tp_richcompare;
1157 PyObject *result = (*f)(operand1, operand2, Py_NE);
1159 if (result != Py_NotImplemented) {
1160 Py_LeaveRecursiveCall();
1165 Py_DECREF_IMMORTAL(result);
1168 f = TP_RICHCOMPARE(type2);
1170 PyObject *result = (*f)(operand2, operand1, Py_NE);
1172 if (result != Py_NotImplemented) {
1173 Py_LeaveRecursiveCall();
1178 Py_DECREF_IMMORTAL(result);
1184 cmpfunc fcmp = NULL;
1185 c = (*fcmp)(operand1, operand2);
1186 }
else if (PyInstance_Check(operand2)) {
1187 cmpfunc fcmp = type2->tp_compare;
1188 c = (*fcmp)(operand1, operand2);
1190 c = try_3way_compare(operand1, operand2);
1194 if (&PyString_Type == type2) {
1195 Py_uintptr_t aa = (Py_uintptr_t)operand1;
1196 Py_uintptr_t bb = (Py_uintptr_t)operand2;
1198 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1199 }
else if (operand1 == Py_None) {
1202 }
else if (operand2 == Py_None) {
1205 }
else if (PyNumber_Check(operand1)) {
1208 if (PyNumber_Check(operand2)) {
1210 Py_uintptr_t aa = (Py_uintptr_t)&PyString_Type;
1211 Py_uintptr_t bb = (Py_uintptr_t)type2;
1213 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1217 }
else if (PyNumber_Check(operand2)) {
1221 int s = strcmp(
"str", type2->tp_name);
1229 Py_uintptr_t aa = (Py_uintptr_t)&PyString_Type;
1230 Py_uintptr_t bb = (Py_uintptr_t)type2;
1232 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1237 Py_LeaveRecursiveCall();
1239 if (unlikely(c <= -2)) {
1265 PyObject *result = BOOL_FROM(r);
1266 Py_INCREF_IMMORTAL(result);
1269 bool checked_reverse_op =
false;
1272 if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1273 f = TP_RICHCOMPARE(type2);
1276 checked_reverse_op =
true;
1278 PyObject *result = (*f)(operand2, operand1, Py_NE);
1280 if (result != Py_NotImplemented) {
1281 Py_LeaveRecursiveCall();
1286 Py_DECREF_IMMORTAL(result);
1290 f = PyString_Type.tp_richcompare;
1293 PyObject *result = (*f)(operand1, operand2, Py_NE);
1295 if (result != Py_NotImplemented) {
1296 Py_LeaveRecursiveCall();
1301 Py_DECREF_IMMORTAL(result);
1304 if (checked_reverse_op ==
false) {
1305 f = TP_RICHCOMPARE(type2);
1308 PyObject *result = (*f)(operand2, operand1, Py_NE);
1310 if (result != Py_NotImplemented) {
1311 Py_LeaveRecursiveCall();
1316 Py_DECREF_IMMORTAL(result);
1320 Py_LeaveRecursiveCall();
1326 bool r = operand1 == operand2;
1327 PyObject *result = BOOL_FROM(r);
1328 Py_INCREF_IMMORTAL(result);
1332 bool r = operand1 != operand2;
1333 PyObject *result = BOOL_FROM(r);
1334 Py_INCREF_IMMORTAL(result);
1338#if PYTHON_VERSION < 0x360
1339 PyErr_Format(PyExc_TypeError,
"unorderable types: str() != %s()", type2->tp_name);
1341 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'str' and '%s'", type2->tp_name);
1349#if PYTHON_VERSION < 0x300
1350static bool COMPARE_NE_CBOOL_STR_STR(PyObject *operand1, PyObject *operand2) {
1351 CHECK_OBJECT(operand1);
1352 assert(PyString_CheckExact(operand1));
1353 CHECK_OBJECT(operand2);
1354 assert(PyString_CheckExact(operand2));
1356 PyStringObject *a = (PyStringObject *)operand1;
1357 PyStringObject *b = (PyStringObject *)operand2;
1360 if (operand1 == operand2) {
1369 Py_ssize_t len_a = Py_SIZE(operand1);
1370 Py_ssize_t len_b = Py_SIZE(operand2);
1372 if (len_a != len_b) {
1380 if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
1398#if PYTHON_VERSION < 0x300
1400nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
1402 if (Py_TYPE(operand1) == &PyString_Type) {
1403 return COMPARE_NE_CBOOL_STR_STR(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1406#if PYTHON_VERSION < 0x300
1407 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
1408 return NUITKA_BOOL_EXCEPTION;
1411 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
1412 return NUITKA_BOOL_EXCEPTION;
1416 PyTypeObject *type1 = Py_TYPE(operand1);
1418#if PYTHON_VERSION < 0x300
1420 if (type1 == &PyString_Type && !0) {
1422 richcmpfunc frich = PyString_Type.tp_richcompare;
1424 if (frich != NULL) {
1425 PyObject *result = (*frich)(operand1, operand2, Py_NE);
1427 if (result != Py_NotImplemented) {
1428 Py_LeaveRecursiveCall();
1430 if (unlikely(result == NULL)) {
1431 return NUITKA_BOOL_EXCEPTION;
1435 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1441 Py_DECREF_IMMORTAL(result);
1445 cmpfunc fcmp = NULL;
1448 int c = (*fcmp)(operand1, operand2);
1449 c = adjust_tp_compare(c);
1451 Py_LeaveRecursiveCall();
1454 return NUITKA_BOOL_EXCEPTION;
1477 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
1481 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1490 if (type1 != &PyString_Type && 0) {
1491 f = PyString_Type.tp_richcompare;
1494 PyObject *result = (*f)(operand2, operand1, Py_NE);
1496 if (result != Py_NotImplemented) {
1497 Py_LeaveRecursiveCall();
1499 if (unlikely(result == NULL)) {
1500 return NUITKA_BOOL_EXCEPTION;
1504 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1510 Py_DECREF_IMMORTAL(result);
1514 f = TP_RICHCOMPARE(type1);
1516 PyObject *result = (*f)(operand1, operand2, Py_NE);
1518 if (result != Py_NotImplemented) {
1519 Py_LeaveRecursiveCall();
1521 if (unlikely(result == NULL)) {
1522 return NUITKA_BOOL_EXCEPTION;
1526 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1532 Py_DECREF_IMMORTAL(result);
1535 f = PyString_Type.tp_richcompare;
1537 PyObject *result = (*f)(operand2, operand1, Py_NE);
1539 if (result != Py_NotImplemented) {
1540 Py_LeaveRecursiveCall();
1542 if (unlikely(result == NULL)) {
1543 return NUITKA_BOOL_EXCEPTION;
1547 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1553 Py_DECREF_IMMORTAL(result);
1558 if (PyInstance_Check(operand1)) {
1559 cmpfunc fcmp = type1->tp_compare;
1560 c = (*fcmp)(operand1, operand2);
1562 cmpfunc fcmp = NULL;
1563 c = (*fcmp)(operand1, operand2);
1565 c = try_3way_compare(operand1, operand2);
1569 if (type1 == &PyString_Type) {
1570 Py_uintptr_t aa = (Py_uintptr_t)operand1;
1571 Py_uintptr_t bb = (Py_uintptr_t)operand2;
1573 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1574 }
else if (operand1 == Py_None) {
1577 }
else if (operand2 == Py_None) {
1580 }
else if (PyNumber_Check(operand1)) {
1583 if (PyNumber_Check(operand2)) {
1585 Py_uintptr_t aa = (Py_uintptr_t)type1;
1586 Py_uintptr_t bb = (Py_uintptr_t)&PyString_Type;
1588 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1592 }
else if (PyNumber_Check(operand2)) {
1596 int s = strcmp(type1->tp_name,
"str");
1604 Py_uintptr_t aa = (Py_uintptr_t)type1;
1605 Py_uintptr_t bb = (Py_uintptr_t)&PyString_Type;
1607 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1612 Py_LeaveRecursiveCall();
1614 if (unlikely(c <= -2)) {
1615 return NUITKA_BOOL_EXCEPTION;
1640 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1644 bool checked_reverse_op =
false;
1647 if (type1 != &PyString_Type && Nuitka_Type_IsSubtype(&PyString_Type, type1)) {
1648 f = PyString_Type.tp_richcompare;
1651 checked_reverse_op =
true;
1653 PyObject *result = (*f)(operand2, operand1, Py_NE);
1655 if (result != Py_NotImplemented) {
1656 Py_LeaveRecursiveCall();
1658 if (unlikely(result == NULL)) {
1659 return NUITKA_BOOL_EXCEPTION;
1663 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1669 Py_DECREF_IMMORTAL(result);
1673 f = TP_RICHCOMPARE(type1);
1676 PyObject *result = (*f)(operand1, operand2, Py_NE);
1678 if (result != Py_NotImplemented) {
1679 Py_LeaveRecursiveCall();
1681 if (unlikely(result == NULL)) {
1682 return NUITKA_BOOL_EXCEPTION;
1686 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1692 Py_DECREF_IMMORTAL(result);
1695 if (checked_reverse_op ==
false) {
1696 f = PyString_Type.tp_richcompare;
1699 PyObject *result = (*f)(operand2, operand1, Py_NE);
1701 if (result != Py_NotImplemented) {
1702 Py_LeaveRecursiveCall();
1704 if (unlikely(result == NULL)) {
1705 return NUITKA_BOOL_EXCEPTION;
1709 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1715 Py_DECREF_IMMORTAL(result);
1719 Py_LeaveRecursiveCall();
1725 bool r = operand1 == operand2;
1726 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1731 bool r = operand1 != operand2;
1732 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1737#if PYTHON_VERSION < 0x360
1738 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != str()", type1->tp_name);
1740 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'str'", type1->tp_name);
1742 return NUITKA_BOOL_EXCEPTION;
1748#if PYTHON_VERSION < 0x300
1750nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *operand2) {
1752 if (&PyString_Type == Py_TYPE(operand2)) {
1753 return COMPARE_NE_CBOOL_STR_STR(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1756#if PYTHON_VERSION < 0x300
1757 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
1758 return NUITKA_BOOL_EXCEPTION;
1761 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
1762 return NUITKA_BOOL_EXCEPTION;
1766 PyTypeObject *type2 = Py_TYPE(operand2);
1768#if PYTHON_VERSION < 0x300
1770 if (&PyString_Type == type2 && !0) {
1772 richcmpfunc frich = PyString_Type.tp_richcompare;
1774 if (frich != NULL) {
1775 PyObject *result = (*frich)(operand1, operand2, Py_NE);
1777 if (result != Py_NotImplemented) {
1778 Py_LeaveRecursiveCall();
1780 if (unlikely(result == NULL)) {
1781 return NUITKA_BOOL_EXCEPTION;
1785 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1791 Py_DECREF_IMMORTAL(result);
1795 cmpfunc fcmp = NULL;
1798 int c = (*fcmp)(operand1, operand2);
1799 c = adjust_tp_compare(c);
1801 Py_LeaveRecursiveCall();
1804 return NUITKA_BOOL_EXCEPTION;
1827 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
1831 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1840 if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1841 f = TP_RICHCOMPARE(type2);
1844 PyObject *result = (*f)(operand2, operand1, Py_NE);
1846 if (result != Py_NotImplemented) {
1847 Py_LeaveRecursiveCall();
1849 if (unlikely(result == NULL)) {
1850 return NUITKA_BOOL_EXCEPTION;
1854 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1860 Py_DECREF_IMMORTAL(result);
1864 f = PyString_Type.tp_richcompare;
1866 PyObject *result = (*f)(operand1, operand2, Py_NE);
1868 if (result != Py_NotImplemented) {
1869 Py_LeaveRecursiveCall();
1871 if (unlikely(result == NULL)) {
1872 return NUITKA_BOOL_EXCEPTION;
1876 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1882 Py_DECREF_IMMORTAL(result);
1885 f = TP_RICHCOMPARE(type2);
1887 PyObject *result = (*f)(operand2, operand1, Py_NE);
1889 if (result != Py_NotImplemented) {
1890 Py_LeaveRecursiveCall();
1892 if (unlikely(result == NULL)) {
1893 return NUITKA_BOOL_EXCEPTION;
1897 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1903 Py_DECREF_IMMORTAL(result);
1909 cmpfunc fcmp = NULL;
1910 c = (*fcmp)(operand1, operand2);
1911 }
else if (PyInstance_Check(operand2)) {
1912 cmpfunc fcmp = type2->tp_compare;
1913 c = (*fcmp)(operand1, operand2);
1915 c = try_3way_compare(operand1, operand2);
1919 if (&PyString_Type == type2) {
1920 Py_uintptr_t aa = (Py_uintptr_t)operand1;
1921 Py_uintptr_t bb = (Py_uintptr_t)operand2;
1923 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1924 }
else if (operand1 == Py_None) {
1927 }
else if (operand2 == Py_None) {
1930 }
else if (PyNumber_Check(operand1)) {
1933 if (PyNumber_Check(operand2)) {
1935 Py_uintptr_t aa = (Py_uintptr_t)&PyString_Type;
1936 Py_uintptr_t bb = (Py_uintptr_t)type2;
1938 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1942 }
else if (PyNumber_Check(operand2)) {
1946 int s = strcmp(
"str", type2->tp_name);
1954 Py_uintptr_t aa = (Py_uintptr_t)&PyString_Type;
1955 Py_uintptr_t bb = (Py_uintptr_t)type2;
1957 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
1962 Py_LeaveRecursiveCall();
1964 if (unlikely(c <= -2)) {
1965 return NUITKA_BOOL_EXCEPTION;
1990 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1994 bool checked_reverse_op =
false;
1997 if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1998 f = TP_RICHCOMPARE(type2);
2001 checked_reverse_op =
true;
2003 PyObject *result = (*f)(operand2, operand1, Py_NE);
2005 if (result != Py_NotImplemented) {
2006 Py_LeaveRecursiveCall();
2008 if (unlikely(result == NULL)) {
2009 return NUITKA_BOOL_EXCEPTION;
2013 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2019 Py_DECREF_IMMORTAL(result);
2023 f = PyString_Type.tp_richcompare;
2026 PyObject *result = (*f)(operand1, operand2, Py_NE);
2028 if (result != Py_NotImplemented) {
2029 Py_LeaveRecursiveCall();
2031 if (unlikely(result == NULL)) {
2032 return NUITKA_BOOL_EXCEPTION;
2036 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2042 Py_DECREF_IMMORTAL(result);
2045 if (checked_reverse_op ==
false) {
2046 f = TP_RICHCOMPARE(type2);
2049 PyObject *result = (*f)(operand2, operand1, Py_NE);
2051 if (result != Py_NotImplemented) {
2052 Py_LeaveRecursiveCall();
2054 if (unlikely(result == NULL)) {
2055 return NUITKA_BOOL_EXCEPTION;
2059 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2065 Py_DECREF_IMMORTAL(result);
2069 Py_LeaveRecursiveCall();
2075 bool r = operand1 == operand2;
2076 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2081 bool r = operand1 != operand2;
2082 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2087#if PYTHON_VERSION < 0x360
2088 PyErr_Format(PyExc_TypeError,
"unorderable types: str() != %s()", type2->tp_name);
2090 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'str' and '%s'", type2->tp_name);
2092 return NUITKA_BOOL_EXCEPTION;
2098static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject *operand2) {
2099 CHECK_OBJECT(operand1);
2100 assert(PyUnicode_CheckExact(operand1));
2101 CHECK_OBJECT(operand2);
2102 assert(PyUnicode_CheckExact(operand2));
2104 PyUnicodeObject *a = (PyUnicodeObject *)operand1;
2105 PyUnicodeObject *b = (PyUnicodeObject *)operand2;
2108 if (operand1 == operand2) {
2112 PyObject *result = BOOL_FROM(r);
2113 Py_INCREF_IMMORTAL(result);
2117#if PYTHON_VERSION >= 0x300
2120 Py_ssize_t len = PyUnicode_GET_LENGTH(a);
2121 if (PyUnicode_GET_LENGTH(b) != len) {
2124 int kind1 = PyUnicode_KIND(a);
2125#if PYTHON_VERSION < 0x3c0
2126 if (unlikely(kind1 == 0)) {
2127 NUITKA_MAY_BE_UNUSED
int res = _PyUnicode_Ready((PyObject *)a);
2129 kind1 = PyUnicode_KIND(a);
2134 int kind2 = PyUnicode_KIND(b);
2135#if PYTHON_VERSION < 0x3c0
2136 if (unlikely(kind2 == 0)) {
2137 NUITKA_MAY_BE_UNUSED
int res = _PyUnicode_Ready((PyObject *)b);
2139 kind2 = PyUnicode_KIND(b);
2144 if (kind1 != kind2) {
2147 const void *data1 = PyUnicode_DATA(a);
2148 const void *data2 = PyUnicode_DATA(b);
2150 int cmp = memcmp(data1, data2, len * kind1);
2155 PyObject *result = BOOL_FROM(r ==
false);
2156 Py_INCREF_IMMORTAL(result);
2161 Py_ssize_t len = PyUnicode_GET_LENGTH(a);
2162 if (PyUnicode_GET_LENGTH(b) != len) {
2165 const Py_UNICODE *data1 = a->str;
2166 const Py_UNICODE *data2 = b->str;
2168 int cmp = memcmp(data1, data2, len *
sizeof(Py_UNICODE));
2172 PyObject *result = BOOL_FROM(r ==
false);
2173 Py_INCREF_IMMORTAL(result);
2178PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *operand2) {
2180 if (Py_TYPE(operand1) == &PyUnicode_Type) {
2181 return COMPARE_NE_OBJECT_UNICODE_UNICODE(operand1, operand2);
2184#if PYTHON_VERSION < 0x300
2185 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
2189 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
2194 PyTypeObject *type1 = Py_TYPE(operand1);
2196#if PYTHON_VERSION < 0x300
2198 if (type1 == &PyUnicode_Type && !0) {
2200 richcmpfunc frich = PyUnicode_Type.tp_richcompare;
2202 if (frich != NULL) {
2203 PyObject *result = (*frich)(operand1, operand2, Py_NE);
2205 if (result != Py_NotImplemented) {
2206 Py_LeaveRecursiveCall();
2211 Py_DECREF_IMMORTAL(result);
2215 cmpfunc fcmp = PyUnicode_Type.tp_compare;
2218 int c = (*fcmp)(operand1, operand2);
2219 c = adjust_tp_compare(c);
2221 Py_LeaveRecursiveCall();
2247 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
2251 PyObject *result = BOOL_FROM(r);
2252 Py_INCREF_IMMORTAL(result);
2260 if (type1 != &PyUnicode_Type && 0) {
2261 f = PyUnicode_Type.tp_richcompare;
2264 PyObject *result = (*f)(operand2, operand1, Py_NE);
2266 if (result != Py_NotImplemented) {
2267 Py_LeaveRecursiveCall();
2272 Py_DECREF_IMMORTAL(result);
2276 f = TP_RICHCOMPARE(type1);
2278 PyObject *result = (*f)(operand1, operand2, Py_NE);
2280 if (result != Py_NotImplemented) {
2281 Py_LeaveRecursiveCall();
2286 Py_DECREF_IMMORTAL(result);
2289 f = PyUnicode_Type.tp_richcompare;
2291 PyObject *result = (*f)(operand2, operand1, Py_NE);
2293 if (result != Py_NotImplemented) {
2294 Py_LeaveRecursiveCall();
2299 Py_DECREF_IMMORTAL(result);
2304 if (PyInstance_Check(operand1)) {
2305 cmpfunc fcmp = type1->tp_compare;
2306 c = (*fcmp)(operand1, operand2);
2308 cmpfunc fcmp = PyUnicode_Type.tp_compare;
2309 c = (*fcmp)(operand1, operand2);
2311 c = try_3way_compare(operand1, operand2);
2315 if (type1 == &PyUnicode_Type) {
2316 Py_uintptr_t aa = (Py_uintptr_t)operand1;
2317 Py_uintptr_t bb = (Py_uintptr_t)operand2;
2319 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2320 }
else if (operand1 == Py_None) {
2323 }
else if (operand2 == Py_None) {
2326 }
else if (PyNumber_Check(operand1)) {
2329 if (PyNumber_Check(operand2)) {
2331 Py_uintptr_t aa = (Py_uintptr_t)type1;
2332 Py_uintptr_t bb = (Py_uintptr_t)&PyUnicode_Type;
2334 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2338 }
else if (PyNumber_Check(operand2)) {
2342 int s = strcmp(type1->tp_name, (PYTHON_VERSION < 0x300 ?
"unicode" :
"str"));
2350 Py_uintptr_t aa = (Py_uintptr_t)type1;
2351 Py_uintptr_t bb = (Py_uintptr_t)&PyUnicode_Type;
2353 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2358 Py_LeaveRecursiveCall();
2360 if (unlikely(c <= -2)) {
2386 PyObject *result = BOOL_FROM(r);
2387 Py_INCREF_IMMORTAL(result);
2390 bool checked_reverse_op =
false;
2393 if (type1 != &PyUnicode_Type && Nuitka_Type_IsSubtype(&PyUnicode_Type, type1)) {
2394 f = PyUnicode_Type.tp_richcompare;
2397 checked_reverse_op =
true;
2399 PyObject *result = (*f)(operand2, operand1, Py_NE);
2401 if (result != Py_NotImplemented) {
2402 Py_LeaveRecursiveCall();
2407 Py_DECREF_IMMORTAL(result);
2411 f = TP_RICHCOMPARE(type1);
2414 PyObject *result = (*f)(operand1, operand2, Py_NE);
2416 if (result != Py_NotImplemented) {
2417 Py_LeaveRecursiveCall();
2422 Py_DECREF_IMMORTAL(result);
2425 if (checked_reverse_op ==
false) {
2426 f = PyUnicode_Type.tp_richcompare;
2429 PyObject *result = (*f)(operand2, operand1, Py_NE);
2431 if (result != Py_NotImplemented) {
2432 Py_LeaveRecursiveCall();
2437 Py_DECREF_IMMORTAL(result);
2441 Py_LeaveRecursiveCall();
2447 bool r = operand1 == operand2;
2448 PyObject *result = BOOL_FROM(r);
2449 Py_INCREF_IMMORTAL(result);
2453 bool r = operand1 != operand2;
2454 PyObject *result = BOOL_FROM(r);
2455 Py_INCREF_IMMORTAL(result);
2459#if PYTHON_VERSION < 0x300
2460 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != unicode()", type1->tp_name);
2461#elif PYTHON_VERSION < 0x360
2462 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != str()", type1->tp_name);
2464 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'str'", type1->tp_name);
2472PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *operand2) {
2474 if (&PyUnicode_Type == Py_TYPE(operand2)) {
2475 return COMPARE_NE_OBJECT_UNICODE_UNICODE(operand1, operand2);
2478#if PYTHON_VERSION < 0x300
2479 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
2483 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
2488 PyTypeObject *type2 = Py_TYPE(operand2);
2490#if PYTHON_VERSION < 0x300
2492 if (&PyUnicode_Type == type2 && !0) {
2494 richcmpfunc frich = PyUnicode_Type.tp_richcompare;
2496 if (frich != NULL) {
2497 PyObject *result = (*frich)(operand1, operand2, Py_NE);
2499 if (result != Py_NotImplemented) {
2500 Py_LeaveRecursiveCall();
2505 Py_DECREF_IMMORTAL(result);
2509 cmpfunc fcmp = PyUnicode_Type.tp_compare;
2512 int c = (*fcmp)(operand1, operand2);
2513 c = adjust_tp_compare(c);
2515 Py_LeaveRecursiveCall();
2541 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
2545 PyObject *result = BOOL_FROM(r);
2546 Py_INCREF_IMMORTAL(result);
2554 if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2555 f = TP_RICHCOMPARE(type2);
2558 PyObject *result = (*f)(operand2, operand1, Py_NE);
2560 if (result != Py_NotImplemented) {
2561 Py_LeaveRecursiveCall();
2566 Py_DECREF_IMMORTAL(result);
2570 f = PyUnicode_Type.tp_richcompare;
2572 PyObject *result = (*f)(operand1, operand2, Py_NE);
2574 if (result != Py_NotImplemented) {
2575 Py_LeaveRecursiveCall();
2580 Py_DECREF_IMMORTAL(result);
2583 f = TP_RICHCOMPARE(type2);
2585 PyObject *result = (*f)(operand2, operand1, Py_NE);
2587 if (result != Py_NotImplemented) {
2588 Py_LeaveRecursiveCall();
2593 Py_DECREF_IMMORTAL(result);
2599 cmpfunc fcmp = PyUnicode_Type.tp_compare;
2600 c = (*fcmp)(operand1, operand2);
2601 }
else if (PyInstance_Check(operand2)) {
2602 cmpfunc fcmp = type2->tp_compare;
2603 c = (*fcmp)(operand1, operand2);
2605 c = try_3way_compare(operand1, operand2);
2609 if (&PyUnicode_Type == type2) {
2610 Py_uintptr_t aa = (Py_uintptr_t)operand1;
2611 Py_uintptr_t bb = (Py_uintptr_t)operand2;
2613 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2614 }
else if (operand1 == Py_None) {
2617 }
else if (operand2 == Py_None) {
2620 }
else if (PyNumber_Check(operand1)) {
2623 if (PyNumber_Check(operand2)) {
2625 Py_uintptr_t aa = (Py_uintptr_t)&PyUnicode_Type;
2626 Py_uintptr_t bb = (Py_uintptr_t)type2;
2628 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2632 }
else if (PyNumber_Check(operand2)) {
2636 int s = strcmp((PYTHON_VERSION < 0x300 ?
"unicode" :
"str"), type2->tp_name);
2644 Py_uintptr_t aa = (Py_uintptr_t)&PyUnicode_Type;
2645 Py_uintptr_t bb = (Py_uintptr_t)type2;
2647 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
2652 Py_LeaveRecursiveCall();
2654 if (unlikely(c <= -2)) {
2680 PyObject *result = BOOL_FROM(r);
2681 Py_INCREF_IMMORTAL(result);
2684 bool checked_reverse_op =
false;
2687 if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2688 f = TP_RICHCOMPARE(type2);
2691 checked_reverse_op =
true;
2693 PyObject *result = (*f)(operand2, operand1, Py_NE);
2695 if (result != Py_NotImplemented) {
2696 Py_LeaveRecursiveCall();
2701 Py_DECREF_IMMORTAL(result);
2705 f = PyUnicode_Type.tp_richcompare;
2708 PyObject *result = (*f)(operand1, operand2, Py_NE);
2710 if (result != Py_NotImplemented) {
2711 Py_LeaveRecursiveCall();
2716 Py_DECREF_IMMORTAL(result);
2719 if (checked_reverse_op ==
false) {
2720 f = TP_RICHCOMPARE(type2);
2723 PyObject *result = (*f)(operand2, operand1, Py_NE);
2725 if (result != Py_NotImplemented) {
2726 Py_LeaveRecursiveCall();
2731 Py_DECREF_IMMORTAL(result);
2735 Py_LeaveRecursiveCall();
2741 bool r = operand1 == operand2;
2742 PyObject *result = BOOL_FROM(r);
2743 Py_INCREF_IMMORTAL(result);
2747 bool r = operand1 != operand2;
2748 PyObject *result = BOOL_FROM(r);
2749 Py_INCREF_IMMORTAL(result);
2753#if PYTHON_VERSION < 0x300
2754 PyErr_Format(PyExc_TypeError,
"unorderable types: unicode() != %s()", type2->tp_name);
2755#elif PYTHON_VERSION < 0x360
2756 PyErr_Format(PyExc_TypeError,
"unorderable types: str() != %s()", type2->tp_name);
2758 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'str' and '%s'", type2->tp_name);
2765static bool COMPARE_NE_CBOOL_UNICODE_UNICODE(PyObject *operand1, PyObject *operand2) {
2766 CHECK_OBJECT(operand1);
2767 assert(PyUnicode_CheckExact(operand1));
2768 CHECK_OBJECT(operand2);
2769 assert(PyUnicode_CheckExact(operand2));
2771 PyUnicodeObject *a = (PyUnicodeObject *)operand1;
2772 PyUnicodeObject *b = (PyUnicodeObject *)operand2;
2775 if (operand1 == operand2) {
2784#if PYTHON_VERSION >= 0x300
2787 Py_ssize_t len = PyUnicode_GET_LENGTH(a);
2788 if (PyUnicode_GET_LENGTH(b) != len) {
2791 int kind1 = PyUnicode_KIND(a);
2792#if PYTHON_VERSION < 0x3c0
2793 if (unlikely(kind1 == 0)) {
2794 NUITKA_MAY_BE_UNUSED
int res = _PyUnicode_Ready((PyObject *)a);
2796 kind1 = PyUnicode_KIND(a);
2801 int kind2 = PyUnicode_KIND(b);
2802#if PYTHON_VERSION < 0x3c0
2803 if (unlikely(kind2 == 0)) {
2804 NUITKA_MAY_BE_UNUSED
int res = _PyUnicode_Ready((PyObject *)b);
2806 kind2 = PyUnicode_KIND(b);
2811 if (kind1 != kind2) {
2814 const void *data1 = PyUnicode_DATA(a);
2815 const void *data2 = PyUnicode_DATA(b);
2817 int cmp = memcmp(data1, data2, len * kind1);
2822 bool result = r ==
false;
2828 Py_ssize_t len = PyUnicode_GET_LENGTH(a);
2829 if (PyUnicode_GET_LENGTH(b) != len) {
2832 const Py_UNICODE *data1 = a->str;
2833 const Py_UNICODE *data2 = b->str;
2835 int cmp = memcmp(data1, data2, len *
sizeof(Py_UNICODE));
2839 bool result = r ==
false;
2845nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *operand2) {
2847 if (Py_TYPE(operand1) == &PyUnicode_Type) {
2848 return COMPARE_NE_CBOOL_UNICODE_UNICODE(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2851#if PYTHON_VERSION < 0x300
2852 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
2853 return NUITKA_BOOL_EXCEPTION;
2856 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
2857 return NUITKA_BOOL_EXCEPTION;
2861 PyTypeObject *type1 = Py_TYPE(operand1);
2863#if PYTHON_VERSION < 0x300
2865 if (type1 == &PyUnicode_Type && !0) {
2867 richcmpfunc frich = PyUnicode_Type.tp_richcompare;
2869 if (frich != NULL) {
2870 PyObject *result = (*frich)(operand1, operand2, Py_NE);
2872 if (result != Py_NotImplemented) {
2873 Py_LeaveRecursiveCall();
2875 if (unlikely(result == NULL)) {
2876 return NUITKA_BOOL_EXCEPTION;
2880 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2886 Py_DECREF_IMMORTAL(result);
2890 cmpfunc fcmp = PyUnicode_Type.tp_compare;
2893 int c = (*fcmp)(operand1, operand2);
2894 c = adjust_tp_compare(c);
2896 Py_LeaveRecursiveCall();
2899 return NUITKA_BOOL_EXCEPTION;
2922 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
2926 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2935 if (type1 != &PyUnicode_Type && 0) {
2936 f = PyUnicode_Type.tp_richcompare;
2939 PyObject *result = (*f)(operand2, operand1, Py_NE);
2941 if (result != Py_NotImplemented) {
2942 Py_LeaveRecursiveCall();
2944 if (unlikely(result == NULL)) {
2945 return NUITKA_BOOL_EXCEPTION;
2949 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2955 Py_DECREF_IMMORTAL(result);
2959 f = TP_RICHCOMPARE(type1);
2961 PyObject *result = (*f)(operand1, operand2, Py_NE);
2963 if (result != Py_NotImplemented) {
2964 Py_LeaveRecursiveCall();
2966 if (unlikely(result == NULL)) {
2967 return NUITKA_BOOL_EXCEPTION;
2971 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2977 Py_DECREF_IMMORTAL(result);
2980 f = PyUnicode_Type.tp_richcompare;
2982 PyObject *result = (*f)(operand2, operand1, Py_NE);
2984 if (result != Py_NotImplemented) {
2985 Py_LeaveRecursiveCall();
2987 if (unlikely(result == NULL)) {
2988 return NUITKA_BOOL_EXCEPTION;
2992 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2998 Py_DECREF_IMMORTAL(result);
3003 if (PyInstance_Check(operand1)) {
3004 cmpfunc fcmp = type1->tp_compare;
3005 c = (*fcmp)(operand1, operand2);
3007 cmpfunc fcmp = PyUnicode_Type.tp_compare;
3008 c = (*fcmp)(operand1, operand2);
3010 c = try_3way_compare(operand1, operand2);
3014 if (type1 == &PyUnicode_Type) {
3015 Py_uintptr_t aa = (Py_uintptr_t)operand1;
3016 Py_uintptr_t bb = (Py_uintptr_t)operand2;
3018 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3019 }
else if (operand1 == Py_None) {
3022 }
else if (operand2 == Py_None) {
3025 }
else if (PyNumber_Check(operand1)) {
3028 if (PyNumber_Check(operand2)) {
3030 Py_uintptr_t aa = (Py_uintptr_t)type1;
3031 Py_uintptr_t bb = (Py_uintptr_t)&PyUnicode_Type;
3033 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3037 }
else if (PyNumber_Check(operand2)) {
3041 int s = strcmp(type1->tp_name, (PYTHON_VERSION < 0x300 ?
"unicode" :
"str"));
3049 Py_uintptr_t aa = (Py_uintptr_t)type1;
3050 Py_uintptr_t bb = (Py_uintptr_t)&PyUnicode_Type;
3052 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3057 Py_LeaveRecursiveCall();
3059 if (unlikely(c <= -2)) {
3060 return NUITKA_BOOL_EXCEPTION;
3085 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3089 bool checked_reverse_op =
false;
3092 if (type1 != &PyUnicode_Type && Nuitka_Type_IsSubtype(&PyUnicode_Type, type1)) {
3093 f = PyUnicode_Type.tp_richcompare;
3096 checked_reverse_op =
true;
3098 PyObject *result = (*f)(operand2, operand1, Py_NE);
3100 if (result != Py_NotImplemented) {
3101 Py_LeaveRecursiveCall();
3103 if (unlikely(result == NULL)) {
3104 return NUITKA_BOOL_EXCEPTION;
3108 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3114 Py_DECREF_IMMORTAL(result);
3118 f = TP_RICHCOMPARE(type1);
3121 PyObject *result = (*f)(operand1, operand2, Py_NE);
3123 if (result != Py_NotImplemented) {
3124 Py_LeaveRecursiveCall();
3126 if (unlikely(result == NULL)) {
3127 return NUITKA_BOOL_EXCEPTION;
3131 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3137 Py_DECREF_IMMORTAL(result);
3140 if (checked_reverse_op ==
false) {
3141 f = PyUnicode_Type.tp_richcompare;
3144 PyObject *result = (*f)(operand2, operand1, Py_NE);
3146 if (result != Py_NotImplemented) {
3147 Py_LeaveRecursiveCall();
3149 if (unlikely(result == NULL)) {
3150 return NUITKA_BOOL_EXCEPTION;
3154 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3160 Py_DECREF_IMMORTAL(result);
3164 Py_LeaveRecursiveCall();
3170 bool r = operand1 == operand2;
3171 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3176 bool r = operand1 != operand2;
3177 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3182#if PYTHON_VERSION < 0x300
3183 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != unicode()", type1->tp_name);
3184#elif PYTHON_VERSION < 0x360
3185 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != str()", type1->tp_name);
3187 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'str'", type1->tp_name);
3189 return NUITKA_BOOL_EXCEPTION;
3195nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *operand2) {
3197 if (&PyUnicode_Type == Py_TYPE(operand2)) {
3198 return COMPARE_NE_CBOOL_UNICODE_UNICODE(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3201#if PYTHON_VERSION < 0x300
3202 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
3203 return NUITKA_BOOL_EXCEPTION;
3206 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
3207 return NUITKA_BOOL_EXCEPTION;
3211 PyTypeObject *type2 = Py_TYPE(operand2);
3213#if PYTHON_VERSION < 0x300
3215 if (&PyUnicode_Type == type2 && !0) {
3217 richcmpfunc frich = PyUnicode_Type.tp_richcompare;
3219 if (frich != NULL) {
3220 PyObject *result = (*frich)(operand1, operand2, Py_NE);
3222 if (result != Py_NotImplemented) {
3223 Py_LeaveRecursiveCall();
3225 if (unlikely(result == NULL)) {
3226 return NUITKA_BOOL_EXCEPTION;
3230 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3236 Py_DECREF_IMMORTAL(result);
3240 cmpfunc fcmp = PyUnicode_Type.tp_compare;
3243 int c = (*fcmp)(operand1, operand2);
3244 c = adjust_tp_compare(c);
3246 Py_LeaveRecursiveCall();
3249 return NUITKA_BOOL_EXCEPTION;
3272 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
3276 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3285 if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3286 f = TP_RICHCOMPARE(type2);
3289 PyObject *result = (*f)(operand2, operand1, Py_NE);
3291 if (result != Py_NotImplemented) {
3292 Py_LeaveRecursiveCall();
3294 if (unlikely(result == NULL)) {
3295 return NUITKA_BOOL_EXCEPTION;
3299 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3305 Py_DECREF_IMMORTAL(result);
3309 f = PyUnicode_Type.tp_richcompare;
3311 PyObject *result = (*f)(operand1, operand2, Py_NE);
3313 if (result != Py_NotImplemented) {
3314 Py_LeaveRecursiveCall();
3316 if (unlikely(result == NULL)) {
3317 return NUITKA_BOOL_EXCEPTION;
3321 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3327 Py_DECREF_IMMORTAL(result);
3330 f = TP_RICHCOMPARE(type2);
3332 PyObject *result = (*f)(operand2, operand1, Py_NE);
3334 if (result != Py_NotImplemented) {
3335 Py_LeaveRecursiveCall();
3337 if (unlikely(result == NULL)) {
3338 return NUITKA_BOOL_EXCEPTION;
3342 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3348 Py_DECREF_IMMORTAL(result);
3354 cmpfunc fcmp = PyUnicode_Type.tp_compare;
3355 c = (*fcmp)(operand1, operand2);
3356 }
else if (PyInstance_Check(operand2)) {
3357 cmpfunc fcmp = type2->tp_compare;
3358 c = (*fcmp)(operand1, operand2);
3360 c = try_3way_compare(operand1, operand2);
3364 if (&PyUnicode_Type == type2) {
3365 Py_uintptr_t aa = (Py_uintptr_t)operand1;
3366 Py_uintptr_t bb = (Py_uintptr_t)operand2;
3368 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3369 }
else if (operand1 == Py_None) {
3372 }
else if (operand2 == Py_None) {
3375 }
else if (PyNumber_Check(operand1)) {
3378 if (PyNumber_Check(operand2)) {
3380 Py_uintptr_t aa = (Py_uintptr_t)&PyUnicode_Type;
3381 Py_uintptr_t bb = (Py_uintptr_t)type2;
3383 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3387 }
else if (PyNumber_Check(operand2)) {
3391 int s = strcmp((PYTHON_VERSION < 0x300 ?
"unicode" :
"str"), type2->tp_name);
3399 Py_uintptr_t aa = (Py_uintptr_t)&PyUnicode_Type;
3400 Py_uintptr_t bb = (Py_uintptr_t)type2;
3402 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3407 Py_LeaveRecursiveCall();
3409 if (unlikely(c <= -2)) {
3410 return NUITKA_BOOL_EXCEPTION;
3435 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3439 bool checked_reverse_op =
false;
3442 if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3443 f = TP_RICHCOMPARE(type2);
3446 checked_reverse_op =
true;
3448 PyObject *result = (*f)(operand2, operand1, Py_NE);
3450 if (result != Py_NotImplemented) {
3451 Py_LeaveRecursiveCall();
3453 if (unlikely(result == NULL)) {
3454 return NUITKA_BOOL_EXCEPTION;
3458 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3464 Py_DECREF_IMMORTAL(result);
3468 f = PyUnicode_Type.tp_richcompare;
3471 PyObject *result = (*f)(operand1, operand2, Py_NE);
3473 if (result != Py_NotImplemented) {
3474 Py_LeaveRecursiveCall();
3476 if (unlikely(result == NULL)) {
3477 return NUITKA_BOOL_EXCEPTION;
3481 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3487 Py_DECREF_IMMORTAL(result);
3490 if (checked_reverse_op ==
false) {
3491 f = TP_RICHCOMPARE(type2);
3494 PyObject *result = (*f)(operand2, operand1, Py_NE);
3496 if (result != Py_NotImplemented) {
3497 Py_LeaveRecursiveCall();
3499 if (unlikely(result == NULL)) {
3500 return NUITKA_BOOL_EXCEPTION;
3504 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3510 Py_DECREF_IMMORTAL(result);
3514 Py_LeaveRecursiveCall();
3520 bool r = operand1 == operand2;
3521 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3526 bool r = operand1 != operand2;
3527 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
3532#if PYTHON_VERSION < 0x300
3533 PyErr_Format(PyExc_TypeError,
"unorderable types: unicode() != %s()", type2->tp_name);
3534#elif PYTHON_VERSION < 0x360
3535 PyErr_Format(PyExc_TypeError,
"unorderable types: str() != %s()", type2->tp_name);
3537 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'str' and '%s'", type2->tp_name);
3539 return NUITKA_BOOL_EXCEPTION;
3544#if PYTHON_VERSION >= 0x300
3545static PyObject *COMPARE_NE_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *operand2) {
3546 CHECK_OBJECT(operand1);
3547 assert(PyBytes_CheckExact(operand1));
3548 CHECK_OBJECT(operand2);
3549 assert(PyBytes_CheckExact(operand2));
3551 PyBytesObject *a = (PyBytesObject *)operand1;
3552 PyBytesObject *b = (PyBytesObject *)operand2;
3555 if (operand1 == operand2) {
3559 PyObject *result = BOOL_FROM(r);
3560 Py_INCREF_IMMORTAL(result);
3564 Py_ssize_t len_a = Py_SIZE(operand1);
3565 Py_ssize_t len_b = Py_SIZE(operand2);
3567 if (len_a != len_b) {
3571 PyObject *result = BOOL_FROM(r);
3572 Py_INCREF_IMMORTAL(result);
3575 if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
3579 PyObject *result = BOOL_FROM(r);
3580 Py_INCREF_IMMORTAL(result);
3586 PyObject *result = BOOL_FROM(r);
3587 Py_INCREF_IMMORTAL(result);
3593#if PYTHON_VERSION >= 0x300
3595PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
3597 if (Py_TYPE(operand1) == &PyBytes_Type) {
3598 return COMPARE_NE_OBJECT_BYTES_BYTES(operand1, operand2);
3601#if PYTHON_VERSION < 0x300
3602 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
3606 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
3611 PyTypeObject *type1 = Py_TYPE(operand1);
3613#if PYTHON_VERSION < 0x300
3615 if (type1 == &PyBytes_Type && !0) {
3617 richcmpfunc frich = PyBytes_Type.tp_richcompare;
3619 if (frich != NULL) {
3620 PyObject *result = (*frich)(operand1, operand2, Py_NE);
3622 if (result != Py_NotImplemented) {
3623 Py_LeaveRecursiveCall();
3628 Py_DECREF_IMMORTAL(result);
3632 cmpfunc fcmp = NULL;
3635 int c = (*fcmp)(operand1, operand2);
3636 c = adjust_tp_compare(c);
3638 Py_LeaveRecursiveCall();
3664 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
3668 PyObject *result = BOOL_FROM(r);
3669 Py_INCREF_IMMORTAL(result);
3677 if (type1 != &PyBytes_Type && 0) {
3678 f = PyBytes_Type.tp_richcompare;
3681 PyObject *result = (*f)(operand2, operand1, Py_NE);
3683 if (result != Py_NotImplemented) {
3684 Py_LeaveRecursiveCall();
3689 Py_DECREF_IMMORTAL(result);
3693 f = TP_RICHCOMPARE(type1);
3695 PyObject *result = (*f)(operand1, operand2, Py_NE);
3697 if (result != Py_NotImplemented) {
3698 Py_LeaveRecursiveCall();
3703 Py_DECREF_IMMORTAL(result);
3706 f = PyBytes_Type.tp_richcompare;
3708 PyObject *result = (*f)(operand2, operand1, Py_NE);
3710 if (result != Py_NotImplemented) {
3711 Py_LeaveRecursiveCall();
3716 Py_DECREF_IMMORTAL(result);
3721 if (PyInstance_Check(operand1)) {
3722 cmpfunc fcmp = type1->tp_compare;
3723 c = (*fcmp)(operand1, operand2);
3725 cmpfunc fcmp = NULL;
3726 c = (*fcmp)(operand1, operand2);
3728 c = try_3way_compare(operand1, operand2);
3732 if (type1 == &PyBytes_Type) {
3733 Py_uintptr_t aa = (Py_uintptr_t)operand1;
3734 Py_uintptr_t bb = (Py_uintptr_t)operand2;
3736 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3737 }
else if (operand1 == Py_None) {
3740 }
else if (operand2 == Py_None) {
3743 }
else if (PyNumber_Check(operand1)) {
3746 if (PyNumber_Check(operand2)) {
3748 Py_uintptr_t aa = (Py_uintptr_t)type1;
3749 Py_uintptr_t bb = (Py_uintptr_t)&PyBytes_Type;
3751 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3755 }
else if (PyNumber_Check(operand2)) {
3759 int s = strcmp(type1->tp_name,
"bytes");
3767 Py_uintptr_t aa = (Py_uintptr_t)type1;
3768 Py_uintptr_t bb = (Py_uintptr_t)&PyBytes_Type;
3770 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
3775 Py_LeaveRecursiveCall();
3777 if (unlikely(c <= -2)) {
3803 PyObject *result = BOOL_FROM(r);
3804 Py_INCREF_IMMORTAL(result);
3807 bool checked_reverse_op =
false;
3810 if (type1 != &PyBytes_Type && Nuitka_Type_IsSubtype(&PyBytes_Type, type1)) {
3811 f = PyBytes_Type.tp_richcompare;
3814 checked_reverse_op =
true;
3816 PyObject *result = (*f)(operand2, operand1, Py_NE);
3818 if (result != Py_NotImplemented) {
3819 Py_LeaveRecursiveCall();
3824 Py_DECREF_IMMORTAL(result);
3828 f = TP_RICHCOMPARE(type1);
3831 PyObject *result = (*f)(operand1, operand2, Py_NE);
3833 if (result != Py_NotImplemented) {
3834 Py_LeaveRecursiveCall();
3839 Py_DECREF_IMMORTAL(result);
3842 if (checked_reverse_op ==
false) {
3843 f = PyBytes_Type.tp_richcompare;
3846 PyObject *result = (*f)(operand2, operand1, Py_NE);
3848 if (result != Py_NotImplemented) {
3849 Py_LeaveRecursiveCall();
3854 Py_DECREF_IMMORTAL(result);
3858 Py_LeaveRecursiveCall();
3864 bool r = operand1 == operand2;
3865 PyObject *result = BOOL_FROM(r);
3866 Py_INCREF_IMMORTAL(result);
3870 bool r = operand1 != operand2;
3871 PyObject *result = BOOL_FROM(r);
3872 Py_INCREF_IMMORTAL(result);
3876#if PYTHON_VERSION < 0x360
3877 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != bytes()", type1->tp_name);
3879 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'bytes'", type1->tp_name);
3887#if PYTHON_VERSION >= 0x300
3889PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *operand2) {
3891 if (&PyBytes_Type == Py_TYPE(operand2)) {
3892 return COMPARE_NE_OBJECT_BYTES_BYTES(operand1, operand2);
3895#if PYTHON_VERSION < 0x300
3896 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
3900 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
3905 PyTypeObject *type2 = Py_TYPE(operand2);
3907#if PYTHON_VERSION < 0x300
3909 if (&PyBytes_Type == type2 && !0) {
3911 richcmpfunc frich = PyBytes_Type.tp_richcompare;
3913 if (frich != NULL) {
3914 PyObject *result = (*frich)(operand1, operand2, Py_NE);
3916 if (result != Py_NotImplemented) {
3917 Py_LeaveRecursiveCall();
3922 Py_DECREF_IMMORTAL(result);
3926 cmpfunc fcmp = NULL;
3929 int c = (*fcmp)(operand1, operand2);
3930 c = adjust_tp_compare(c);
3932 Py_LeaveRecursiveCall();
3958 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
3962 PyObject *result = BOOL_FROM(r);
3963 Py_INCREF_IMMORTAL(result);
3971 if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
3972 f = TP_RICHCOMPARE(type2);
3975 PyObject *result = (*f)(operand2, operand1, Py_NE);
3977 if (result != Py_NotImplemented) {
3978 Py_LeaveRecursiveCall();
3983 Py_DECREF_IMMORTAL(result);
3987 f = PyBytes_Type.tp_richcompare;
3989 PyObject *result = (*f)(operand1, operand2, Py_NE);
3991 if (result != Py_NotImplemented) {
3992 Py_LeaveRecursiveCall();
3997 Py_DECREF_IMMORTAL(result);
4000 f = TP_RICHCOMPARE(type2);
4002 PyObject *result = (*f)(operand2, operand1, Py_NE);
4004 if (result != Py_NotImplemented) {
4005 Py_LeaveRecursiveCall();
4010 Py_DECREF_IMMORTAL(result);
4016 cmpfunc fcmp = NULL;
4017 c = (*fcmp)(operand1, operand2);
4018 }
else if (PyInstance_Check(operand2)) {
4019 cmpfunc fcmp = type2->tp_compare;
4020 c = (*fcmp)(operand1, operand2);
4022 c = try_3way_compare(operand1, operand2);
4026 if (&PyBytes_Type == type2) {
4027 Py_uintptr_t aa = (Py_uintptr_t)operand1;
4028 Py_uintptr_t bb = (Py_uintptr_t)operand2;
4030 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4031 }
else if (operand1 == Py_None) {
4034 }
else if (operand2 == Py_None) {
4037 }
else if (PyNumber_Check(operand1)) {
4040 if (PyNumber_Check(operand2)) {
4042 Py_uintptr_t aa = (Py_uintptr_t)&PyBytes_Type;
4043 Py_uintptr_t bb = (Py_uintptr_t)type2;
4045 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4049 }
else if (PyNumber_Check(operand2)) {
4053 int s = strcmp(
"bytes", type2->tp_name);
4061 Py_uintptr_t aa = (Py_uintptr_t)&PyBytes_Type;
4062 Py_uintptr_t bb = (Py_uintptr_t)type2;
4064 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4069 Py_LeaveRecursiveCall();
4071 if (unlikely(c <= -2)) {
4097 PyObject *result = BOOL_FROM(r);
4098 Py_INCREF_IMMORTAL(result);
4101 bool checked_reverse_op =
false;
4104 if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4105 f = TP_RICHCOMPARE(type2);
4108 checked_reverse_op =
true;
4110 PyObject *result = (*f)(operand2, operand1, Py_NE);
4112 if (result != Py_NotImplemented) {
4113 Py_LeaveRecursiveCall();
4118 Py_DECREF_IMMORTAL(result);
4122 f = PyBytes_Type.tp_richcompare;
4125 PyObject *result = (*f)(operand1, operand2, Py_NE);
4127 if (result != Py_NotImplemented) {
4128 Py_LeaveRecursiveCall();
4133 Py_DECREF_IMMORTAL(result);
4136 if (checked_reverse_op ==
false) {
4137 f = TP_RICHCOMPARE(type2);
4140 PyObject *result = (*f)(operand2, operand1, Py_NE);
4142 if (result != Py_NotImplemented) {
4143 Py_LeaveRecursiveCall();
4148 Py_DECREF_IMMORTAL(result);
4152 Py_LeaveRecursiveCall();
4158 bool r = operand1 == operand2;
4159 PyObject *result = BOOL_FROM(r);
4160 Py_INCREF_IMMORTAL(result);
4164 bool r = operand1 != operand2;
4165 PyObject *result = BOOL_FROM(r);
4166 Py_INCREF_IMMORTAL(result);
4170#if PYTHON_VERSION < 0x360
4171 PyErr_Format(PyExc_TypeError,
"unorderable types: bytes() != %s()", type2->tp_name);
4173 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'bytes' and '%s'", type2->tp_name);
4181#if PYTHON_VERSION >= 0x300
4182static bool COMPARE_NE_CBOOL_BYTES_BYTES(PyObject *operand1, PyObject *operand2) {
4183 CHECK_OBJECT(operand1);
4184 assert(PyBytes_CheckExact(operand1));
4185 CHECK_OBJECT(operand2);
4186 assert(PyBytes_CheckExact(operand2));
4188 PyBytesObject *a = (PyBytesObject *)operand1;
4189 PyBytesObject *b = (PyBytesObject *)operand2;
4192 if (operand1 == operand2) {
4201 Py_ssize_t len_a = Py_SIZE(operand1);
4202 Py_ssize_t len_b = Py_SIZE(operand2);
4204 if (len_a != len_b) {
4212 if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
4230#if PYTHON_VERSION >= 0x300
4232nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
4234 if (Py_TYPE(operand1) == &PyBytes_Type) {
4235 return COMPARE_NE_CBOOL_BYTES_BYTES(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4238#if PYTHON_VERSION < 0x300
4239 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
4240 return NUITKA_BOOL_EXCEPTION;
4243 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
4244 return NUITKA_BOOL_EXCEPTION;
4248 PyTypeObject *type1 = Py_TYPE(operand1);
4250#if PYTHON_VERSION < 0x300
4252 if (type1 == &PyBytes_Type && !0) {
4254 richcmpfunc frich = PyBytes_Type.tp_richcompare;
4256 if (frich != NULL) {
4257 PyObject *result = (*frich)(operand1, operand2, Py_NE);
4259 if (result != Py_NotImplemented) {
4260 Py_LeaveRecursiveCall();
4262 if (unlikely(result == NULL)) {
4263 return NUITKA_BOOL_EXCEPTION;
4267 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4273 Py_DECREF_IMMORTAL(result);
4277 cmpfunc fcmp = NULL;
4280 int c = (*fcmp)(operand1, operand2);
4281 c = adjust_tp_compare(c);
4283 Py_LeaveRecursiveCall();
4286 return NUITKA_BOOL_EXCEPTION;
4309 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
4313 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4322 if (type1 != &PyBytes_Type && 0) {
4323 f = PyBytes_Type.tp_richcompare;
4326 PyObject *result = (*f)(operand2, operand1, Py_NE);
4328 if (result != Py_NotImplemented) {
4329 Py_LeaveRecursiveCall();
4331 if (unlikely(result == NULL)) {
4332 return NUITKA_BOOL_EXCEPTION;
4336 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4342 Py_DECREF_IMMORTAL(result);
4346 f = TP_RICHCOMPARE(type1);
4348 PyObject *result = (*f)(operand1, operand2, Py_NE);
4350 if (result != Py_NotImplemented) {
4351 Py_LeaveRecursiveCall();
4353 if (unlikely(result == NULL)) {
4354 return NUITKA_BOOL_EXCEPTION;
4358 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4364 Py_DECREF_IMMORTAL(result);
4367 f = PyBytes_Type.tp_richcompare;
4369 PyObject *result = (*f)(operand2, operand1, Py_NE);
4371 if (result != Py_NotImplemented) {
4372 Py_LeaveRecursiveCall();
4374 if (unlikely(result == NULL)) {
4375 return NUITKA_BOOL_EXCEPTION;
4379 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4385 Py_DECREF_IMMORTAL(result);
4390 if (PyInstance_Check(operand1)) {
4391 cmpfunc fcmp = type1->tp_compare;
4392 c = (*fcmp)(operand1, operand2);
4394 cmpfunc fcmp = NULL;
4395 c = (*fcmp)(operand1, operand2);
4397 c = try_3way_compare(operand1, operand2);
4401 if (type1 == &PyBytes_Type) {
4402 Py_uintptr_t aa = (Py_uintptr_t)operand1;
4403 Py_uintptr_t bb = (Py_uintptr_t)operand2;
4405 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4406 }
else if (operand1 == Py_None) {
4409 }
else if (operand2 == Py_None) {
4412 }
else if (PyNumber_Check(operand1)) {
4415 if (PyNumber_Check(operand2)) {
4417 Py_uintptr_t aa = (Py_uintptr_t)type1;
4418 Py_uintptr_t bb = (Py_uintptr_t)&PyBytes_Type;
4420 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4424 }
else if (PyNumber_Check(operand2)) {
4428 int s = strcmp(type1->tp_name,
"bytes");
4436 Py_uintptr_t aa = (Py_uintptr_t)type1;
4437 Py_uintptr_t bb = (Py_uintptr_t)&PyBytes_Type;
4439 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4444 Py_LeaveRecursiveCall();
4446 if (unlikely(c <= -2)) {
4447 return NUITKA_BOOL_EXCEPTION;
4472 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4476 bool checked_reverse_op =
false;
4479 if (type1 != &PyBytes_Type && Nuitka_Type_IsSubtype(&PyBytes_Type, type1)) {
4480 f = PyBytes_Type.tp_richcompare;
4483 checked_reverse_op =
true;
4485 PyObject *result = (*f)(operand2, operand1, Py_NE);
4487 if (result != Py_NotImplemented) {
4488 Py_LeaveRecursiveCall();
4490 if (unlikely(result == NULL)) {
4491 return NUITKA_BOOL_EXCEPTION;
4495 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4501 Py_DECREF_IMMORTAL(result);
4505 f = TP_RICHCOMPARE(type1);
4508 PyObject *result = (*f)(operand1, operand2, Py_NE);
4510 if (result != Py_NotImplemented) {
4511 Py_LeaveRecursiveCall();
4513 if (unlikely(result == NULL)) {
4514 return NUITKA_BOOL_EXCEPTION;
4518 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4524 Py_DECREF_IMMORTAL(result);
4527 if (checked_reverse_op ==
false) {
4528 f = PyBytes_Type.tp_richcompare;
4531 PyObject *result = (*f)(operand2, operand1, Py_NE);
4533 if (result != Py_NotImplemented) {
4534 Py_LeaveRecursiveCall();
4536 if (unlikely(result == NULL)) {
4537 return NUITKA_BOOL_EXCEPTION;
4541 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4547 Py_DECREF_IMMORTAL(result);
4551 Py_LeaveRecursiveCall();
4557 bool r = operand1 == operand2;
4558 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4563 bool r = operand1 != operand2;
4564 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4569#if PYTHON_VERSION < 0x360
4570 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != bytes()", type1->tp_name);
4572 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'bytes'", type1->tp_name);
4574 return NUITKA_BOOL_EXCEPTION;
4580#if PYTHON_VERSION >= 0x300
4582nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *operand2) {
4584 if (&PyBytes_Type == Py_TYPE(operand2)) {
4585 return COMPARE_NE_CBOOL_BYTES_BYTES(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4588#if PYTHON_VERSION < 0x300
4589 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
4590 return NUITKA_BOOL_EXCEPTION;
4593 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
4594 return NUITKA_BOOL_EXCEPTION;
4598 PyTypeObject *type2 = Py_TYPE(operand2);
4600#if PYTHON_VERSION < 0x300
4602 if (&PyBytes_Type == type2 && !0) {
4604 richcmpfunc frich = PyBytes_Type.tp_richcompare;
4606 if (frich != NULL) {
4607 PyObject *result = (*frich)(operand1, operand2, Py_NE);
4609 if (result != Py_NotImplemented) {
4610 Py_LeaveRecursiveCall();
4612 if (unlikely(result == NULL)) {
4613 return NUITKA_BOOL_EXCEPTION;
4617 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4623 Py_DECREF_IMMORTAL(result);
4627 cmpfunc fcmp = NULL;
4630 int c = (*fcmp)(operand1, operand2);
4631 c = adjust_tp_compare(c);
4633 Py_LeaveRecursiveCall();
4636 return NUITKA_BOOL_EXCEPTION;
4659 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
4663 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4672 if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4673 f = TP_RICHCOMPARE(type2);
4676 PyObject *result = (*f)(operand2, operand1, Py_NE);
4678 if (result != Py_NotImplemented) {
4679 Py_LeaveRecursiveCall();
4681 if (unlikely(result == NULL)) {
4682 return NUITKA_BOOL_EXCEPTION;
4686 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4692 Py_DECREF_IMMORTAL(result);
4696 f = PyBytes_Type.tp_richcompare;
4698 PyObject *result = (*f)(operand1, operand2, Py_NE);
4700 if (result != Py_NotImplemented) {
4701 Py_LeaveRecursiveCall();
4703 if (unlikely(result == NULL)) {
4704 return NUITKA_BOOL_EXCEPTION;
4708 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4714 Py_DECREF_IMMORTAL(result);
4717 f = TP_RICHCOMPARE(type2);
4719 PyObject *result = (*f)(operand2, operand1, Py_NE);
4721 if (result != Py_NotImplemented) {
4722 Py_LeaveRecursiveCall();
4724 if (unlikely(result == NULL)) {
4725 return NUITKA_BOOL_EXCEPTION;
4729 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4735 Py_DECREF_IMMORTAL(result);
4741 cmpfunc fcmp = NULL;
4742 c = (*fcmp)(operand1, operand2);
4743 }
else if (PyInstance_Check(operand2)) {
4744 cmpfunc fcmp = type2->tp_compare;
4745 c = (*fcmp)(operand1, operand2);
4747 c = try_3way_compare(operand1, operand2);
4751 if (&PyBytes_Type == type2) {
4752 Py_uintptr_t aa = (Py_uintptr_t)operand1;
4753 Py_uintptr_t bb = (Py_uintptr_t)operand2;
4755 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4756 }
else if (operand1 == Py_None) {
4759 }
else if (operand2 == Py_None) {
4762 }
else if (PyNumber_Check(operand1)) {
4765 if (PyNumber_Check(operand2)) {
4767 Py_uintptr_t aa = (Py_uintptr_t)&PyBytes_Type;
4768 Py_uintptr_t bb = (Py_uintptr_t)type2;
4770 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4774 }
else if (PyNumber_Check(operand2)) {
4778 int s = strcmp(
"bytes", type2->tp_name);
4786 Py_uintptr_t aa = (Py_uintptr_t)&PyBytes_Type;
4787 Py_uintptr_t bb = (Py_uintptr_t)type2;
4789 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
4794 Py_LeaveRecursiveCall();
4796 if (unlikely(c <= -2)) {
4797 return NUITKA_BOOL_EXCEPTION;
4822 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4826 bool checked_reverse_op =
false;
4829 if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4830 f = TP_RICHCOMPARE(type2);
4833 checked_reverse_op =
true;
4835 PyObject *result = (*f)(operand2, operand1, Py_NE);
4837 if (result != Py_NotImplemented) {
4838 Py_LeaveRecursiveCall();
4840 if (unlikely(result == NULL)) {
4841 return NUITKA_BOOL_EXCEPTION;
4845 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4851 Py_DECREF_IMMORTAL(result);
4855 f = PyBytes_Type.tp_richcompare;
4858 PyObject *result = (*f)(operand1, operand2, Py_NE);
4860 if (result != Py_NotImplemented) {
4861 Py_LeaveRecursiveCall();
4863 if (unlikely(result == NULL)) {
4864 return NUITKA_BOOL_EXCEPTION;
4868 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4874 Py_DECREF_IMMORTAL(result);
4877 if (checked_reverse_op ==
false) {
4878 f = TP_RICHCOMPARE(type2);
4881 PyObject *result = (*f)(operand2, operand1, Py_NE);
4883 if (result != Py_NotImplemented) {
4884 Py_LeaveRecursiveCall();
4886 if (unlikely(result == NULL)) {
4887 return NUITKA_BOOL_EXCEPTION;
4891 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4897 Py_DECREF_IMMORTAL(result);
4901 Py_LeaveRecursiveCall();
4907 bool r = operand1 == operand2;
4908 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4913 bool r = operand1 != operand2;
4914 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
4919#if PYTHON_VERSION < 0x360
4920 PyErr_Format(PyExc_TypeError,
"unorderable types: bytes() != %s()", type2->tp_name);
4922 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'bytes' and '%s'", type2->tp_name);
4924 return NUITKA_BOOL_EXCEPTION;
4930#if PYTHON_VERSION < 0x300
4932PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
4934 if (Py_TYPE(operand1) == &PyInt_Type) {
4935 return COMPARE_NE_OBJECT_INT_INT(operand1, operand2);
4938#if PYTHON_VERSION < 0x300
4939 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
4943 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
4948 PyTypeObject *type1 = Py_TYPE(operand1);
4950#if PYTHON_VERSION < 0x300
4952 if (type1 == &PyInt_Type && !0) {
4954 richcmpfunc frich = NULL;
4956 if (frich != NULL) {
4957 PyObject *result = (*frich)(operand1, operand2, Py_NE);
4959 if (result != Py_NotImplemented) {
4960 Py_LeaveRecursiveCall();
4965 Py_DECREF_IMMORTAL(result);
4969 cmpfunc fcmp = PyInt_Type.tp_compare;
4972 int c = (*fcmp)(operand1, operand2);
4973 c = adjust_tp_compare(c);
4975 Py_LeaveRecursiveCall();
5001 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
5005 PyObject *result = BOOL_FROM(r);
5006 Py_INCREF_IMMORTAL(result);
5014 if (type1 != &PyInt_Type && 0) {
5018 PyObject *result = (*f)(operand2, operand1, Py_NE);
5020 if (result != Py_NotImplemented) {
5021 Py_LeaveRecursiveCall();
5026 Py_DECREF_IMMORTAL(result);
5030 f = TP_RICHCOMPARE(type1);
5032 PyObject *result = (*f)(operand1, operand2, Py_NE);
5034 if (result != Py_NotImplemented) {
5035 Py_LeaveRecursiveCall();
5040 Py_DECREF_IMMORTAL(result);
5045 PyObject *result = (*f)(operand2, operand1, Py_NE);
5047 if (result != Py_NotImplemented) {
5048 Py_LeaveRecursiveCall();
5053 Py_DECREF_IMMORTAL(result);
5058 if (PyInstance_Check(operand1)) {
5059 cmpfunc fcmp = type1->tp_compare;
5060 c = (*fcmp)(operand1, operand2);
5062 cmpfunc fcmp = PyInt_Type.tp_compare;
5063 c = (*fcmp)(operand1, operand2);
5065 c = try_3way_compare(operand1, operand2);
5069 if (type1 == &PyInt_Type) {
5070 Py_uintptr_t aa = (Py_uintptr_t)operand1;
5071 Py_uintptr_t bb = (Py_uintptr_t)operand2;
5073 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5074 }
else if (operand1 == Py_None) {
5077 }
else if (operand2 == Py_None) {
5080 }
else if (PyNumber_Check(operand1)) {
5083 if (PyNumber_Check(operand2)) {
5085 Py_uintptr_t aa = (Py_uintptr_t)type1;
5086 Py_uintptr_t bb = (Py_uintptr_t)&PyInt_Type;
5088 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5092 }
else if (PyNumber_Check(operand2)) {
5096 int s = strcmp(type1->tp_name,
"int");
5104 Py_uintptr_t aa = (Py_uintptr_t)type1;
5105 Py_uintptr_t bb = (Py_uintptr_t)&PyInt_Type;
5107 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5112 Py_LeaveRecursiveCall();
5114 if (unlikely(c <= -2)) {
5140 PyObject *result = BOOL_FROM(r);
5141 Py_INCREF_IMMORTAL(result);
5144 bool checked_reverse_op =
false;
5147 if (type1 != &PyInt_Type && Nuitka_Type_IsSubtype(&PyInt_Type, type1)) {
5151 checked_reverse_op =
true;
5153 PyObject *result = (*f)(operand2, operand1, Py_NE);
5155 if (result != Py_NotImplemented) {
5156 Py_LeaveRecursiveCall();
5161 Py_DECREF_IMMORTAL(result);
5165 f = TP_RICHCOMPARE(type1);
5168 PyObject *result = (*f)(operand1, operand2, Py_NE);
5170 if (result != Py_NotImplemented) {
5171 Py_LeaveRecursiveCall();
5176 Py_DECREF_IMMORTAL(result);
5179 if (checked_reverse_op ==
false) {
5183 PyObject *result = (*f)(operand2, operand1, Py_NE);
5185 if (result != Py_NotImplemented) {
5186 Py_LeaveRecursiveCall();
5191 Py_DECREF_IMMORTAL(result);
5195 Py_LeaveRecursiveCall();
5201 bool r = operand1 == operand2;
5202 PyObject *result = BOOL_FROM(r);
5203 Py_INCREF_IMMORTAL(result);
5207 bool r = operand1 != operand2;
5208 PyObject *result = BOOL_FROM(r);
5209 Py_INCREF_IMMORTAL(result);
5213#if PYTHON_VERSION < 0x360
5214 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != int()", type1->tp_name);
5216 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'int'", type1->tp_name);
5224#if PYTHON_VERSION < 0x300
5226PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
5228 if (&PyInt_Type == Py_TYPE(operand2)) {
5229 return COMPARE_NE_OBJECT_INT_INT(operand1, operand2);
5232#if PYTHON_VERSION < 0x300
5233 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
5237 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
5242 PyTypeObject *type2 = Py_TYPE(operand2);
5244#if PYTHON_VERSION < 0x300
5246 if (&PyInt_Type == type2 && !0) {
5248 richcmpfunc frich = NULL;
5250 if (frich != NULL) {
5251 PyObject *result = (*frich)(operand1, operand2, Py_NE);
5253 if (result != Py_NotImplemented) {
5254 Py_LeaveRecursiveCall();
5259 Py_DECREF_IMMORTAL(result);
5263 cmpfunc fcmp = PyInt_Type.tp_compare;
5266 int c = (*fcmp)(operand1, operand2);
5267 c = adjust_tp_compare(c);
5269 Py_LeaveRecursiveCall();
5295 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
5299 PyObject *result = BOOL_FROM(r);
5300 Py_INCREF_IMMORTAL(result);
5308 if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5309 f = TP_RICHCOMPARE(type2);
5312 PyObject *result = (*f)(operand2, operand1, Py_NE);
5314 if (result != Py_NotImplemented) {
5315 Py_LeaveRecursiveCall();
5320 Py_DECREF_IMMORTAL(result);
5326 PyObject *result = (*f)(operand1, operand2, Py_NE);
5328 if (result != Py_NotImplemented) {
5329 Py_LeaveRecursiveCall();
5334 Py_DECREF_IMMORTAL(result);
5337 f = TP_RICHCOMPARE(type2);
5339 PyObject *result = (*f)(operand2, operand1, Py_NE);
5341 if (result != Py_NotImplemented) {
5342 Py_LeaveRecursiveCall();
5347 Py_DECREF_IMMORTAL(result);
5353 cmpfunc fcmp = PyInt_Type.tp_compare;
5354 c = (*fcmp)(operand1, operand2);
5355 }
else if (PyInstance_Check(operand2)) {
5356 cmpfunc fcmp = type2->tp_compare;
5357 c = (*fcmp)(operand1, operand2);
5359 c = try_3way_compare(operand1, operand2);
5363 if (&PyInt_Type == type2) {
5364 Py_uintptr_t aa = (Py_uintptr_t)operand1;
5365 Py_uintptr_t bb = (Py_uintptr_t)operand2;
5367 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5368 }
else if (operand1 == Py_None) {
5371 }
else if (operand2 == Py_None) {
5374 }
else if (PyNumber_Check(operand1)) {
5377 if (PyNumber_Check(operand2)) {
5379 Py_uintptr_t aa = (Py_uintptr_t)&PyInt_Type;
5380 Py_uintptr_t bb = (Py_uintptr_t)type2;
5382 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5386 }
else if (PyNumber_Check(operand2)) {
5390 int s = strcmp(
"int", type2->tp_name);
5398 Py_uintptr_t aa = (Py_uintptr_t)&PyInt_Type;
5399 Py_uintptr_t bb = (Py_uintptr_t)type2;
5401 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5406 Py_LeaveRecursiveCall();
5408 if (unlikely(c <= -2)) {
5434 PyObject *result = BOOL_FROM(r);
5435 Py_INCREF_IMMORTAL(result);
5438 bool checked_reverse_op =
false;
5441 if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5442 f = TP_RICHCOMPARE(type2);
5445 checked_reverse_op =
true;
5447 PyObject *result = (*f)(operand2, operand1, Py_NE);
5449 if (result != Py_NotImplemented) {
5450 Py_LeaveRecursiveCall();
5455 Py_DECREF_IMMORTAL(result);
5462 PyObject *result = (*f)(operand1, operand2, Py_NE);
5464 if (result != Py_NotImplemented) {
5465 Py_LeaveRecursiveCall();
5470 Py_DECREF_IMMORTAL(result);
5473 if (checked_reverse_op ==
false) {
5474 f = TP_RICHCOMPARE(type2);
5477 PyObject *result = (*f)(operand2, operand1, Py_NE);
5479 if (result != Py_NotImplemented) {
5480 Py_LeaveRecursiveCall();
5485 Py_DECREF_IMMORTAL(result);
5489 Py_LeaveRecursiveCall();
5495 bool r = operand1 == operand2;
5496 PyObject *result = BOOL_FROM(r);
5497 Py_INCREF_IMMORTAL(result);
5501 bool r = operand1 != operand2;
5502 PyObject *result = BOOL_FROM(r);
5503 Py_INCREF_IMMORTAL(result);
5507#if PYTHON_VERSION < 0x360
5508 PyErr_Format(PyExc_TypeError,
"unorderable types: int() != %s()", type2->tp_name);
5510 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'int' and '%s'", type2->tp_name);
5518#if PYTHON_VERSION < 0x300
5520nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
5522 if (Py_TYPE(operand1) == &PyInt_Type) {
5523 return COMPARE_NE_CBOOL_INT_INT(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5526#if PYTHON_VERSION < 0x300
5527 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
5528 return NUITKA_BOOL_EXCEPTION;
5531 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
5532 return NUITKA_BOOL_EXCEPTION;
5536 PyTypeObject *type1 = Py_TYPE(operand1);
5538#if PYTHON_VERSION < 0x300
5540 if (type1 == &PyInt_Type && !0) {
5542 richcmpfunc frich = NULL;
5544 if (frich != NULL) {
5545 PyObject *result = (*frich)(operand1, operand2, Py_NE);
5547 if (result != Py_NotImplemented) {
5548 Py_LeaveRecursiveCall();
5550 if (unlikely(result == NULL)) {
5551 return NUITKA_BOOL_EXCEPTION;
5555 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5561 Py_DECREF_IMMORTAL(result);
5565 cmpfunc fcmp = PyInt_Type.tp_compare;
5568 int c = (*fcmp)(operand1, operand2);
5569 c = adjust_tp_compare(c);
5571 Py_LeaveRecursiveCall();
5574 return NUITKA_BOOL_EXCEPTION;
5597 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
5601 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5610 if (type1 != &PyInt_Type && 0) {
5614 PyObject *result = (*f)(operand2, operand1, Py_NE);
5616 if (result != Py_NotImplemented) {
5617 Py_LeaveRecursiveCall();
5619 if (unlikely(result == NULL)) {
5620 return NUITKA_BOOL_EXCEPTION;
5624 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5630 Py_DECREF_IMMORTAL(result);
5634 f = TP_RICHCOMPARE(type1);
5636 PyObject *result = (*f)(operand1, operand2, Py_NE);
5638 if (result != Py_NotImplemented) {
5639 Py_LeaveRecursiveCall();
5641 if (unlikely(result == NULL)) {
5642 return NUITKA_BOOL_EXCEPTION;
5646 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5652 Py_DECREF_IMMORTAL(result);
5657 PyObject *result = (*f)(operand2, operand1, Py_NE);
5659 if (result != Py_NotImplemented) {
5660 Py_LeaveRecursiveCall();
5662 if (unlikely(result == NULL)) {
5663 return NUITKA_BOOL_EXCEPTION;
5667 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5673 Py_DECREF_IMMORTAL(result);
5678 if (PyInstance_Check(operand1)) {
5679 cmpfunc fcmp = type1->tp_compare;
5680 c = (*fcmp)(operand1, operand2);
5682 cmpfunc fcmp = PyInt_Type.tp_compare;
5683 c = (*fcmp)(operand1, operand2);
5685 c = try_3way_compare(operand1, operand2);
5689 if (type1 == &PyInt_Type) {
5690 Py_uintptr_t aa = (Py_uintptr_t)operand1;
5691 Py_uintptr_t bb = (Py_uintptr_t)operand2;
5693 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5694 }
else if (operand1 == Py_None) {
5697 }
else if (operand2 == Py_None) {
5700 }
else if (PyNumber_Check(operand1)) {
5703 if (PyNumber_Check(operand2)) {
5705 Py_uintptr_t aa = (Py_uintptr_t)type1;
5706 Py_uintptr_t bb = (Py_uintptr_t)&PyInt_Type;
5708 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5712 }
else if (PyNumber_Check(operand2)) {
5716 int s = strcmp(type1->tp_name,
"int");
5724 Py_uintptr_t aa = (Py_uintptr_t)type1;
5725 Py_uintptr_t bb = (Py_uintptr_t)&PyInt_Type;
5727 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
5732 Py_LeaveRecursiveCall();
5734 if (unlikely(c <= -2)) {
5735 return NUITKA_BOOL_EXCEPTION;
5760 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5764 bool checked_reverse_op =
false;
5767 if (type1 != &PyInt_Type && Nuitka_Type_IsSubtype(&PyInt_Type, type1)) {
5771 checked_reverse_op =
true;
5773 PyObject *result = (*f)(operand2, operand1, Py_NE);
5775 if (result != Py_NotImplemented) {
5776 Py_LeaveRecursiveCall();
5778 if (unlikely(result == NULL)) {
5779 return NUITKA_BOOL_EXCEPTION;
5783 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5789 Py_DECREF_IMMORTAL(result);
5793 f = TP_RICHCOMPARE(type1);
5796 PyObject *result = (*f)(operand1, operand2, Py_NE);
5798 if (result != Py_NotImplemented) {
5799 Py_LeaveRecursiveCall();
5801 if (unlikely(result == NULL)) {
5802 return NUITKA_BOOL_EXCEPTION;
5806 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5812 Py_DECREF_IMMORTAL(result);
5815 if (checked_reverse_op ==
false) {
5819 PyObject *result = (*f)(operand2, operand1, Py_NE);
5821 if (result != Py_NotImplemented) {
5822 Py_LeaveRecursiveCall();
5824 if (unlikely(result == NULL)) {
5825 return NUITKA_BOOL_EXCEPTION;
5829 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5835 Py_DECREF_IMMORTAL(result);
5839 Py_LeaveRecursiveCall();
5845 bool r = operand1 == operand2;
5846 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5851 bool r = operand1 != operand2;
5852 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5857#if PYTHON_VERSION < 0x360
5858 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != int()", type1->tp_name);
5860 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'int'", type1->tp_name);
5862 return NUITKA_BOOL_EXCEPTION;
5868#if PYTHON_VERSION < 0x300
5870nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
5872 if (&PyInt_Type == Py_TYPE(operand2)) {
5873 return COMPARE_NE_CBOOL_INT_INT(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5876#if PYTHON_VERSION < 0x300
5877 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
5878 return NUITKA_BOOL_EXCEPTION;
5881 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
5882 return NUITKA_BOOL_EXCEPTION;
5886 PyTypeObject *type2 = Py_TYPE(operand2);
5888#if PYTHON_VERSION < 0x300
5890 if (&PyInt_Type == type2 && !0) {
5892 richcmpfunc frich = NULL;
5894 if (frich != NULL) {
5895 PyObject *result = (*frich)(operand1, operand2, Py_NE);
5897 if (result != Py_NotImplemented) {
5898 Py_LeaveRecursiveCall();
5900 if (unlikely(result == NULL)) {
5901 return NUITKA_BOOL_EXCEPTION;
5905 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5911 Py_DECREF_IMMORTAL(result);
5915 cmpfunc fcmp = PyInt_Type.tp_compare;
5918 int c = (*fcmp)(operand1, operand2);
5919 c = adjust_tp_compare(c);
5921 Py_LeaveRecursiveCall();
5924 return NUITKA_BOOL_EXCEPTION;
5947 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
5951 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5960 if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5961 f = TP_RICHCOMPARE(type2);
5964 PyObject *result = (*f)(operand2, operand1, Py_NE);
5966 if (result != Py_NotImplemented) {
5967 Py_LeaveRecursiveCall();
5969 if (unlikely(result == NULL)) {
5970 return NUITKA_BOOL_EXCEPTION;
5974 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
5980 Py_DECREF_IMMORTAL(result);
5986 PyObject *result = (*f)(operand1, operand2, Py_NE);
5988 if (result != Py_NotImplemented) {
5989 Py_LeaveRecursiveCall();
5991 if (unlikely(result == NULL)) {
5992 return NUITKA_BOOL_EXCEPTION;
5996 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6002 Py_DECREF_IMMORTAL(result);
6005 f = TP_RICHCOMPARE(type2);
6007 PyObject *result = (*f)(operand2, operand1, Py_NE);
6009 if (result != Py_NotImplemented) {
6010 Py_LeaveRecursiveCall();
6012 if (unlikely(result == NULL)) {
6013 return NUITKA_BOOL_EXCEPTION;
6017 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6023 Py_DECREF_IMMORTAL(result);
6029 cmpfunc fcmp = PyInt_Type.tp_compare;
6030 c = (*fcmp)(operand1, operand2);
6031 }
else if (PyInstance_Check(operand2)) {
6032 cmpfunc fcmp = type2->tp_compare;
6033 c = (*fcmp)(operand1, operand2);
6035 c = try_3way_compare(operand1, operand2);
6039 if (&PyInt_Type == type2) {
6040 Py_uintptr_t aa = (Py_uintptr_t)operand1;
6041 Py_uintptr_t bb = (Py_uintptr_t)operand2;
6043 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6044 }
else if (operand1 == Py_None) {
6047 }
else if (operand2 == Py_None) {
6050 }
else if (PyNumber_Check(operand1)) {
6053 if (PyNumber_Check(operand2)) {
6055 Py_uintptr_t aa = (Py_uintptr_t)&PyInt_Type;
6056 Py_uintptr_t bb = (Py_uintptr_t)type2;
6058 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6062 }
else if (PyNumber_Check(operand2)) {
6066 int s = strcmp(
"int", type2->tp_name);
6074 Py_uintptr_t aa = (Py_uintptr_t)&PyInt_Type;
6075 Py_uintptr_t bb = (Py_uintptr_t)type2;
6077 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6082 Py_LeaveRecursiveCall();
6084 if (unlikely(c <= -2)) {
6085 return NUITKA_BOOL_EXCEPTION;
6110 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6114 bool checked_reverse_op =
false;
6117 if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
6118 f = TP_RICHCOMPARE(type2);
6121 checked_reverse_op =
true;
6123 PyObject *result = (*f)(operand2, operand1, Py_NE);
6125 if (result != Py_NotImplemented) {
6126 Py_LeaveRecursiveCall();
6128 if (unlikely(result == NULL)) {
6129 return NUITKA_BOOL_EXCEPTION;
6133 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6139 Py_DECREF_IMMORTAL(result);
6146 PyObject *result = (*f)(operand1, operand2, Py_NE);
6148 if (result != Py_NotImplemented) {
6149 Py_LeaveRecursiveCall();
6151 if (unlikely(result == NULL)) {
6152 return NUITKA_BOOL_EXCEPTION;
6156 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6162 Py_DECREF_IMMORTAL(result);
6165 if (checked_reverse_op ==
false) {
6166 f = TP_RICHCOMPARE(type2);
6169 PyObject *result = (*f)(operand2, operand1, Py_NE);
6171 if (result != Py_NotImplemented) {
6172 Py_LeaveRecursiveCall();
6174 if (unlikely(result == NULL)) {
6175 return NUITKA_BOOL_EXCEPTION;
6179 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6185 Py_DECREF_IMMORTAL(result);
6189 Py_LeaveRecursiveCall();
6195 bool r = operand1 == operand2;
6196 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6201 bool r = operand1 != operand2;
6202 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6207#if PYTHON_VERSION < 0x360
6208 PyErr_Format(PyExc_TypeError,
"unorderable types: int() != %s()", type2->tp_name);
6210 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'int' and '%s'", type2->tp_name);
6212 return NUITKA_BOOL_EXCEPTION;
6218static PyObject *COMPARE_NE_OBJECT_LONG_LONG(PyObject *operand1, PyObject *operand2) {
6219 CHECK_OBJECT(operand1);
6220 assert(PyLong_CheckExact(operand1));
6221 CHECK_OBJECT(operand2);
6222 assert(PyLong_CheckExact(operand2));
6224 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
6226 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
6230 if (operand1_long_object == operand2_long_object) {
6232 }
else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6233 Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6236 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6239 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6240 Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6248 PyObject *result = BOOL_FROM(r);
6249 Py_INCREF_IMMORTAL(result);
6253PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
6255 if (Py_TYPE(operand1) == &PyLong_Type) {
6256 return COMPARE_NE_OBJECT_LONG_LONG(operand1, operand2);
6259#if PYTHON_VERSION < 0x300
6260 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
6264 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
6269 PyTypeObject *type1 = Py_TYPE(operand1);
6271#if PYTHON_VERSION < 0x300
6273 if (type1 == &PyLong_Type && !0) {
6275 richcmpfunc frich = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6277 if (frich != NULL) {
6278 PyObject *result = (*frich)(operand1, operand2, Py_NE);
6280 if (result != Py_NotImplemented) {
6281 Py_LeaveRecursiveCall();
6286 Py_DECREF_IMMORTAL(result);
6290 cmpfunc fcmp = PyLong_Type.tp_compare;
6293 int c = (*fcmp)(operand1, operand2);
6294 c = adjust_tp_compare(c);
6296 Py_LeaveRecursiveCall();
6322 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
6326 PyObject *result = BOOL_FROM(r);
6327 Py_INCREF_IMMORTAL(result);
6335 if (type1 != &PyLong_Type && 0) {
6336 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6339 PyObject *result = (*f)(operand2, operand1, Py_NE);
6341 if (result != Py_NotImplemented) {
6342 Py_LeaveRecursiveCall();
6347 Py_DECREF_IMMORTAL(result);
6351 f = TP_RICHCOMPARE(type1);
6353 PyObject *result = (*f)(operand1, operand2, Py_NE);
6355 if (result != Py_NotImplemented) {
6356 Py_LeaveRecursiveCall();
6361 Py_DECREF_IMMORTAL(result);
6364 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6366 PyObject *result = (*f)(operand2, operand1, Py_NE);
6368 if (result != Py_NotImplemented) {
6369 Py_LeaveRecursiveCall();
6374 Py_DECREF_IMMORTAL(result);
6379 if (PyInstance_Check(operand1)) {
6380 cmpfunc fcmp = type1->tp_compare;
6381 c = (*fcmp)(operand1, operand2);
6383 cmpfunc fcmp = PyLong_Type.tp_compare;
6384 c = (*fcmp)(operand1, operand2);
6386 c = try_3way_compare(operand1, operand2);
6390 if (type1 == &PyLong_Type) {
6391 Py_uintptr_t aa = (Py_uintptr_t)operand1;
6392 Py_uintptr_t bb = (Py_uintptr_t)operand2;
6394 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6395 }
else if (operand1 == Py_None) {
6398 }
else if (operand2 == Py_None) {
6401 }
else if (PyNumber_Check(operand1)) {
6404 if (PyNumber_Check(operand2)) {
6406 Py_uintptr_t aa = (Py_uintptr_t)type1;
6407 Py_uintptr_t bb = (Py_uintptr_t)&PyLong_Type;
6409 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6413 }
else if (PyNumber_Check(operand2)) {
6417 int s = strcmp(type1->tp_name, (PYTHON_VERSION < 0x300 ?
"long" :
"int"));
6425 Py_uintptr_t aa = (Py_uintptr_t)type1;
6426 Py_uintptr_t bb = (Py_uintptr_t)&PyLong_Type;
6428 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6433 Py_LeaveRecursiveCall();
6435 if (unlikely(c <= -2)) {
6461 PyObject *result = BOOL_FROM(r);
6462 Py_INCREF_IMMORTAL(result);
6465 bool checked_reverse_op =
false;
6468 if (type1 != &PyLong_Type && Nuitka_Type_IsSubtype(&PyLong_Type, type1)) {
6469 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6472 checked_reverse_op =
true;
6474 PyObject *result = (*f)(operand2, operand1, Py_NE);
6476 if (result != Py_NotImplemented) {
6477 Py_LeaveRecursiveCall();
6482 Py_DECREF_IMMORTAL(result);
6486 f = TP_RICHCOMPARE(type1);
6489 PyObject *result = (*f)(operand1, operand2, Py_NE);
6491 if (result != Py_NotImplemented) {
6492 Py_LeaveRecursiveCall();
6497 Py_DECREF_IMMORTAL(result);
6500 if (checked_reverse_op ==
false) {
6501 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6504 PyObject *result = (*f)(operand2, operand1, Py_NE);
6506 if (result != Py_NotImplemented) {
6507 Py_LeaveRecursiveCall();
6512 Py_DECREF_IMMORTAL(result);
6516 Py_LeaveRecursiveCall();
6522 bool r = operand1 == operand2;
6523 PyObject *result = BOOL_FROM(r);
6524 Py_INCREF_IMMORTAL(result);
6528 bool r = operand1 != operand2;
6529 PyObject *result = BOOL_FROM(r);
6530 Py_INCREF_IMMORTAL(result);
6534#if PYTHON_VERSION < 0x300
6535 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != long()", type1->tp_name);
6536#elif PYTHON_VERSION < 0x360
6537 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != int()", type1->tp_name);
6539 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'int'", type1->tp_name);
6547PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
6549 if (&PyLong_Type == Py_TYPE(operand2)) {
6550 return COMPARE_NE_OBJECT_LONG_LONG(operand1, operand2);
6553#if PYTHON_VERSION < 0x300
6554 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
6558 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
6563 PyTypeObject *type2 = Py_TYPE(operand2);
6565#if PYTHON_VERSION < 0x300
6567 if (&PyLong_Type == type2 && !0) {
6569 richcmpfunc frich = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6571 if (frich != NULL) {
6572 PyObject *result = (*frich)(operand1, operand2, Py_NE);
6574 if (result != Py_NotImplemented) {
6575 Py_LeaveRecursiveCall();
6580 Py_DECREF_IMMORTAL(result);
6584 cmpfunc fcmp = PyLong_Type.tp_compare;
6587 int c = (*fcmp)(operand1, operand2);
6588 c = adjust_tp_compare(c);
6590 Py_LeaveRecursiveCall();
6616 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
6620 PyObject *result = BOOL_FROM(r);
6621 Py_INCREF_IMMORTAL(result);
6629 if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6630 f = TP_RICHCOMPARE(type2);
6633 PyObject *result = (*f)(operand2, operand1, Py_NE);
6635 if (result != Py_NotImplemented) {
6636 Py_LeaveRecursiveCall();
6641 Py_DECREF_IMMORTAL(result);
6645 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6647 PyObject *result = (*f)(operand1, operand2, Py_NE);
6649 if (result != Py_NotImplemented) {
6650 Py_LeaveRecursiveCall();
6655 Py_DECREF_IMMORTAL(result);
6658 f = TP_RICHCOMPARE(type2);
6660 PyObject *result = (*f)(operand2, operand1, Py_NE);
6662 if (result != Py_NotImplemented) {
6663 Py_LeaveRecursiveCall();
6668 Py_DECREF_IMMORTAL(result);
6674 cmpfunc fcmp = PyLong_Type.tp_compare;
6675 c = (*fcmp)(operand1, operand2);
6676 }
else if (PyInstance_Check(operand2)) {
6677 cmpfunc fcmp = type2->tp_compare;
6678 c = (*fcmp)(operand1, operand2);
6680 c = try_3way_compare(operand1, operand2);
6684 if (&PyLong_Type == type2) {
6685 Py_uintptr_t aa = (Py_uintptr_t)operand1;
6686 Py_uintptr_t bb = (Py_uintptr_t)operand2;
6688 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6689 }
else if (operand1 == Py_None) {
6692 }
else if (operand2 == Py_None) {
6695 }
else if (PyNumber_Check(operand1)) {
6698 if (PyNumber_Check(operand2)) {
6700 Py_uintptr_t aa = (Py_uintptr_t)&PyLong_Type;
6701 Py_uintptr_t bb = (Py_uintptr_t)type2;
6703 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6707 }
else if (PyNumber_Check(operand2)) {
6711 int s = strcmp((PYTHON_VERSION < 0x300 ?
"long" :
"int"), type2->tp_name);
6719 Py_uintptr_t aa = (Py_uintptr_t)&PyLong_Type;
6720 Py_uintptr_t bb = (Py_uintptr_t)type2;
6722 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
6727 Py_LeaveRecursiveCall();
6729 if (unlikely(c <= -2)) {
6755 PyObject *result = BOOL_FROM(r);
6756 Py_INCREF_IMMORTAL(result);
6759 bool checked_reverse_op =
false;
6762 if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6763 f = TP_RICHCOMPARE(type2);
6766 checked_reverse_op =
true;
6768 PyObject *result = (*f)(operand2, operand1, Py_NE);
6770 if (result != Py_NotImplemented) {
6771 Py_LeaveRecursiveCall();
6776 Py_DECREF_IMMORTAL(result);
6780 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6783 PyObject *result = (*f)(operand1, operand2, Py_NE);
6785 if (result != Py_NotImplemented) {
6786 Py_LeaveRecursiveCall();
6791 Py_DECREF_IMMORTAL(result);
6794 if (checked_reverse_op ==
false) {
6795 f = TP_RICHCOMPARE(type2);
6798 PyObject *result = (*f)(operand2, operand1, Py_NE);
6800 if (result != Py_NotImplemented) {
6801 Py_LeaveRecursiveCall();
6806 Py_DECREF_IMMORTAL(result);
6810 Py_LeaveRecursiveCall();
6816 bool r = operand1 == operand2;
6817 PyObject *result = BOOL_FROM(r);
6818 Py_INCREF_IMMORTAL(result);
6822 bool r = operand1 != operand2;
6823 PyObject *result = BOOL_FROM(r);
6824 Py_INCREF_IMMORTAL(result);
6828#if PYTHON_VERSION < 0x300
6829 PyErr_Format(PyExc_TypeError,
"unorderable types: long() != %s()", type2->tp_name);
6830#elif PYTHON_VERSION < 0x360
6831 PyErr_Format(PyExc_TypeError,
"unorderable types: int() != %s()", type2->tp_name);
6833 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'int' and '%s'", type2->tp_name);
6840static bool COMPARE_NE_CBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
6841 CHECK_OBJECT(operand1);
6842 assert(PyLong_CheckExact(operand1));
6843 CHECK_OBJECT(operand2);
6844 assert(PyLong_CheckExact(operand2));
6846 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
6848 PyLongObject *operand2_long_object = (PyLongObject *)operand2;
6852 if (operand1_long_object == operand2_long_object) {
6854 }
else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6855 Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6858 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6861 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6862 Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6875nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
6877 if (Py_TYPE(operand1) == &PyLong_Type) {
6878 return COMPARE_NE_CBOOL_LONG_LONG(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6881#if PYTHON_VERSION < 0x300
6882 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
6883 return NUITKA_BOOL_EXCEPTION;
6886 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
6887 return NUITKA_BOOL_EXCEPTION;
6891 PyTypeObject *type1 = Py_TYPE(operand1);
6893#if PYTHON_VERSION < 0x300
6895 if (type1 == &PyLong_Type && !0) {
6897 richcmpfunc frich = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6899 if (frich != NULL) {
6900 PyObject *result = (*frich)(operand1, operand2, Py_NE);
6902 if (result != Py_NotImplemented) {
6903 Py_LeaveRecursiveCall();
6905 if (unlikely(result == NULL)) {
6906 return NUITKA_BOOL_EXCEPTION;
6910 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6916 Py_DECREF_IMMORTAL(result);
6920 cmpfunc fcmp = PyLong_Type.tp_compare;
6923 int c = (*fcmp)(operand1, operand2);
6924 c = adjust_tp_compare(c);
6926 Py_LeaveRecursiveCall();
6929 return NUITKA_BOOL_EXCEPTION;
6952 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
6956 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6965 if (type1 != &PyLong_Type && 0) {
6966 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
6969 PyObject *result = (*f)(operand2, operand1, Py_NE);
6971 if (result != Py_NotImplemented) {
6972 Py_LeaveRecursiveCall();
6974 if (unlikely(result == NULL)) {
6975 return NUITKA_BOOL_EXCEPTION;
6979 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
6985 Py_DECREF_IMMORTAL(result);
6989 f = TP_RICHCOMPARE(type1);
6991 PyObject *result = (*f)(operand1, operand2, Py_NE);
6993 if (result != Py_NotImplemented) {
6994 Py_LeaveRecursiveCall();
6996 if (unlikely(result == NULL)) {
6997 return NUITKA_BOOL_EXCEPTION;
7001 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7007 Py_DECREF_IMMORTAL(result);
7010 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
7012 PyObject *result = (*f)(operand2, operand1, Py_NE);
7014 if (result != Py_NotImplemented) {
7015 Py_LeaveRecursiveCall();
7017 if (unlikely(result == NULL)) {
7018 return NUITKA_BOOL_EXCEPTION;
7022 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7028 Py_DECREF_IMMORTAL(result);
7033 if (PyInstance_Check(operand1)) {
7034 cmpfunc fcmp = type1->tp_compare;
7035 c = (*fcmp)(operand1, operand2);
7037 cmpfunc fcmp = PyLong_Type.tp_compare;
7038 c = (*fcmp)(operand1, operand2);
7040 c = try_3way_compare(operand1, operand2);
7044 if (type1 == &PyLong_Type) {
7045 Py_uintptr_t aa = (Py_uintptr_t)operand1;
7046 Py_uintptr_t bb = (Py_uintptr_t)operand2;
7048 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7049 }
else if (operand1 == Py_None) {
7052 }
else if (operand2 == Py_None) {
7055 }
else if (PyNumber_Check(operand1)) {
7058 if (PyNumber_Check(operand2)) {
7060 Py_uintptr_t aa = (Py_uintptr_t)type1;
7061 Py_uintptr_t bb = (Py_uintptr_t)&PyLong_Type;
7063 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7067 }
else if (PyNumber_Check(operand2)) {
7071 int s = strcmp(type1->tp_name, (PYTHON_VERSION < 0x300 ?
"long" :
"int"));
7079 Py_uintptr_t aa = (Py_uintptr_t)type1;
7080 Py_uintptr_t bb = (Py_uintptr_t)&PyLong_Type;
7082 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7087 Py_LeaveRecursiveCall();
7089 if (unlikely(c <= -2)) {
7090 return NUITKA_BOOL_EXCEPTION;
7115 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7119 bool checked_reverse_op =
false;
7122 if (type1 != &PyLong_Type && Nuitka_Type_IsSubtype(&PyLong_Type, type1)) {
7123 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
7126 checked_reverse_op =
true;
7128 PyObject *result = (*f)(operand2, operand1, Py_NE);
7130 if (result != Py_NotImplemented) {
7131 Py_LeaveRecursiveCall();
7133 if (unlikely(result == NULL)) {
7134 return NUITKA_BOOL_EXCEPTION;
7138 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7144 Py_DECREF_IMMORTAL(result);
7148 f = TP_RICHCOMPARE(type1);
7151 PyObject *result = (*f)(operand1, operand2, Py_NE);
7153 if (result != Py_NotImplemented) {
7154 Py_LeaveRecursiveCall();
7156 if (unlikely(result == NULL)) {
7157 return NUITKA_BOOL_EXCEPTION;
7161 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7167 Py_DECREF_IMMORTAL(result);
7170 if (checked_reverse_op ==
false) {
7171 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
7174 PyObject *result = (*f)(operand2, operand1, Py_NE);
7176 if (result != Py_NotImplemented) {
7177 Py_LeaveRecursiveCall();
7179 if (unlikely(result == NULL)) {
7180 return NUITKA_BOOL_EXCEPTION;
7184 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7190 Py_DECREF_IMMORTAL(result);
7194 Py_LeaveRecursiveCall();
7200 bool r = operand1 == operand2;
7201 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7206 bool r = operand1 != operand2;
7207 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7212#if PYTHON_VERSION < 0x300
7213 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != long()", type1->tp_name);
7214#elif PYTHON_VERSION < 0x360
7215 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != int()", type1->tp_name);
7217 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'int'", type1->tp_name);
7219 return NUITKA_BOOL_EXCEPTION;
7225nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
7227 if (&PyLong_Type == Py_TYPE(operand2)) {
7228 return COMPARE_NE_CBOOL_LONG_LONG(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7231#if PYTHON_VERSION < 0x300
7232 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
7233 return NUITKA_BOOL_EXCEPTION;
7236 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
7237 return NUITKA_BOOL_EXCEPTION;
7241 PyTypeObject *type2 = Py_TYPE(operand2);
7243#if PYTHON_VERSION < 0x300
7245 if (&PyLong_Type == type2 && !0) {
7247 richcmpfunc frich = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
7249 if (frich != NULL) {
7250 PyObject *result = (*frich)(operand1, operand2, Py_NE);
7252 if (result != Py_NotImplemented) {
7253 Py_LeaveRecursiveCall();
7255 if (unlikely(result == NULL)) {
7256 return NUITKA_BOOL_EXCEPTION;
7260 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7266 Py_DECREF_IMMORTAL(result);
7270 cmpfunc fcmp = PyLong_Type.tp_compare;
7273 int c = (*fcmp)(operand1, operand2);
7274 c = adjust_tp_compare(c);
7276 Py_LeaveRecursiveCall();
7279 return NUITKA_BOOL_EXCEPTION;
7302 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
7306 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7315 if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7316 f = TP_RICHCOMPARE(type2);
7319 PyObject *result = (*f)(operand2, operand1, Py_NE);
7321 if (result != Py_NotImplemented) {
7322 Py_LeaveRecursiveCall();
7324 if (unlikely(result == NULL)) {
7325 return NUITKA_BOOL_EXCEPTION;
7329 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7335 Py_DECREF_IMMORTAL(result);
7339 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
7341 PyObject *result = (*f)(operand1, operand2, Py_NE);
7343 if (result != Py_NotImplemented) {
7344 Py_LeaveRecursiveCall();
7346 if (unlikely(result == NULL)) {
7347 return NUITKA_BOOL_EXCEPTION;
7351 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7357 Py_DECREF_IMMORTAL(result);
7360 f = TP_RICHCOMPARE(type2);
7362 PyObject *result = (*f)(operand2, operand1, Py_NE);
7364 if (result != Py_NotImplemented) {
7365 Py_LeaveRecursiveCall();
7367 if (unlikely(result == NULL)) {
7368 return NUITKA_BOOL_EXCEPTION;
7372 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7378 Py_DECREF_IMMORTAL(result);
7384 cmpfunc fcmp = PyLong_Type.tp_compare;
7385 c = (*fcmp)(operand1, operand2);
7386 }
else if (PyInstance_Check(operand2)) {
7387 cmpfunc fcmp = type2->tp_compare;
7388 c = (*fcmp)(operand1, operand2);
7390 c = try_3way_compare(operand1, operand2);
7394 if (&PyLong_Type == type2) {
7395 Py_uintptr_t aa = (Py_uintptr_t)operand1;
7396 Py_uintptr_t bb = (Py_uintptr_t)operand2;
7398 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7399 }
else if (operand1 == Py_None) {
7402 }
else if (operand2 == Py_None) {
7405 }
else if (PyNumber_Check(operand1)) {
7408 if (PyNumber_Check(operand2)) {
7410 Py_uintptr_t aa = (Py_uintptr_t)&PyLong_Type;
7411 Py_uintptr_t bb = (Py_uintptr_t)type2;
7413 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7417 }
else if (PyNumber_Check(operand2)) {
7421 int s = strcmp((PYTHON_VERSION < 0x300 ?
"long" :
"int"), type2->tp_name);
7429 Py_uintptr_t aa = (Py_uintptr_t)&PyLong_Type;
7430 Py_uintptr_t bb = (Py_uintptr_t)type2;
7432 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7437 Py_LeaveRecursiveCall();
7439 if (unlikely(c <= -2)) {
7440 return NUITKA_BOOL_EXCEPTION;
7465 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7469 bool checked_reverse_op =
false;
7472 if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7473 f = TP_RICHCOMPARE(type2);
7476 checked_reverse_op =
true;
7478 PyObject *result = (*f)(operand2, operand1, Py_NE);
7480 if (result != Py_NotImplemented) {
7481 Py_LeaveRecursiveCall();
7483 if (unlikely(result == NULL)) {
7484 return NUITKA_BOOL_EXCEPTION;
7488 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7494 Py_DECREF_IMMORTAL(result);
7498 f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
7501 PyObject *result = (*f)(operand1, operand2, Py_NE);
7503 if (result != Py_NotImplemented) {
7504 Py_LeaveRecursiveCall();
7506 if (unlikely(result == NULL)) {
7507 return NUITKA_BOOL_EXCEPTION;
7511 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7517 Py_DECREF_IMMORTAL(result);
7520 if (checked_reverse_op ==
false) {
7521 f = TP_RICHCOMPARE(type2);
7524 PyObject *result = (*f)(operand2, operand1, Py_NE);
7526 if (result != Py_NotImplemented) {
7527 Py_LeaveRecursiveCall();
7529 if (unlikely(result == NULL)) {
7530 return NUITKA_BOOL_EXCEPTION;
7534 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7540 Py_DECREF_IMMORTAL(result);
7544 Py_LeaveRecursiveCall();
7550 bool r = operand1 == operand2;
7551 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7556 bool r = operand1 != operand2;
7557 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
7562#if PYTHON_VERSION < 0x300
7563 PyErr_Format(PyExc_TypeError,
"unorderable types: long() != %s()", type2->tp_name);
7564#elif PYTHON_VERSION < 0x360
7565 PyErr_Format(PyExc_TypeError,
"unorderable types: int() != %s()", type2->tp_name);
7567 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'int' and '%s'", type2->tp_name);
7569 return NUITKA_BOOL_EXCEPTION;
7574static PyObject *COMPARE_NE_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
7575 CHECK_OBJECT(operand1);
7576 assert(PyFloat_CheckExact(operand1));
7577 CHECK_OBJECT(operand2);
7578 assert(PyFloat_CheckExact(operand2));
7580 const double a = PyFloat_AS_DOUBLE(operand1);
7581 const double b = PyFloat_AS_DOUBLE(operand2);
7586 PyObject *result = BOOL_FROM(r);
7587 Py_INCREF_IMMORTAL(result);
7591PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
7593 if (Py_TYPE(operand1) == &PyFloat_Type) {
7594 return COMPARE_NE_OBJECT_FLOAT_FLOAT(operand1, operand2);
7597#if PYTHON_VERSION < 0x300
7598 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
7602 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
7607 PyTypeObject *type1 = Py_TYPE(operand1);
7609#if PYTHON_VERSION < 0x300
7611 if (type1 == &PyFloat_Type && !0) {
7613 richcmpfunc frich = PyFloat_Type.tp_richcompare;
7615 if (frich != NULL) {
7616 PyObject *result = (*frich)(operand1, operand2, Py_NE);
7618 if (result != Py_NotImplemented) {
7619 Py_LeaveRecursiveCall();
7624 Py_DECREF_IMMORTAL(result);
7628 cmpfunc fcmp = NULL;
7631 int c = (*fcmp)(operand1, operand2);
7632 c = adjust_tp_compare(c);
7634 Py_LeaveRecursiveCall();
7660 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
7664 PyObject *result = BOOL_FROM(r);
7665 Py_INCREF_IMMORTAL(result);
7673 if (type1 != &PyFloat_Type && 0) {
7674 f = PyFloat_Type.tp_richcompare;
7677 PyObject *result = (*f)(operand2, operand1, Py_NE);
7679 if (result != Py_NotImplemented) {
7680 Py_LeaveRecursiveCall();
7685 Py_DECREF_IMMORTAL(result);
7689 f = TP_RICHCOMPARE(type1);
7691 PyObject *result = (*f)(operand1, operand2, Py_NE);
7693 if (result != Py_NotImplemented) {
7694 Py_LeaveRecursiveCall();
7699 Py_DECREF_IMMORTAL(result);
7702 f = PyFloat_Type.tp_richcompare;
7704 PyObject *result = (*f)(operand2, operand1, Py_NE);
7706 if (result != Py_NotImplemented) {
7707 Py_LeaveRecursiveCall();
7712 Py_DECREF_IMMORTAL(result);
7717 if (PyInstance_Check(operand1)) {
7718 cmpfunc fcmp = type1->tp_compare;
7719 c = (*fcmp)(operand1, operand2);
7721 cmpfunc fcmp = NULL;
7722 c = (*fcmp)(operand1, operand2);
7724 c = try_3way_compare(operand1, operand2);
7728 if (type1 == &PyFloat_Type) {
7729 Py_uintptr_t aa = (Py_uintptr_t)operand1;
7730 Py_uintptr_t bb = (Py_uintptr_t)operand2;
7732 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7733 }
else if (operand1 == Py_None) {
7736 }
else if (operand2 == Py_None) {
7739 }
else if (PyNumber_Check(operand1)) {
7742 if (PyNumber_Check(operand2)) {
7744 Py_uintptr_t aa = (Py_uintptr_t)type1;
7745 Py_uintptr_t bb = (Py_uintptr_t)&PyFloat_Type;
7747 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7751 }
else if (PyNumber_Check(operand2)) {
7755 int s = strcmp(type1->tp_name,
"float");
7763 Py_uintptr_t aa = (Py_uintptr_t)type1;
7764 Py_uintptr_t bb = (Py_uintptr_t)&PyFloat_Type;
7766 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
7771 Py_LeaveRecursiveCall();
7773 if (unlikely(c <= -2)) {
7799 PyObject *result = BOOL_FROM(r);
7800 Py_INCREF_IMMORTAL(result);
7803 bool checked_reverse_op =
false;
7806 if (type1 != &PyFloat_Type && Nuitka_Type_IsSubtype(&PyFloat_Type, type1)) {
7807 f = PyFloat_Type.tp_richcompare;
7810 checked_reverse_op =
true;
7812 PyObject *result = (*f)(operand2, operand1, Py_NE);
7814 if (result != Py_NotImplemented) {
7815 Py_LeaveRecursiveCall();
7820 Py_DECREF_IMMORTAL(result);
7824 f = TP_RICHCOMPARE(type1);
7827 PyObject *result = (*f)(operand1, operand2, Py_NE);
7829 if (result != Py_NotImplemented) {
7830 Py_LeaveRecursiveCall();
7835 Py_DECREF_IMMORTAL(result);
7838 if (checked_reverse_op ==
false) {
7839 f = PyFloat_Type.tp_richcompare;
7842 PyObject *result = (*f)(operand2, operand1, Py_NE);
7844 if (result != Py_NotImplemented) {
7845 Py_LeaveRecursiveCall();
7850 Py_DECREF_IMMORTAL(result);
7854 Py_LeaveRecursiveCall();
7860 bool r = operand1 == operand2;
7861 PyObject *result = BOOL_FROM(r);
7862 Py_INCREF_IMMORTAL(result);
7866 bool r = operand1 != operand2;
7867 PyObject *result = BOOL_FROM(r);
7868 Py_INCREF_IMMORTAL(result);
7872#if PYTHON_VERSION < 0x360
7873 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != float()", type1->tp_name);
7875 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'float'", type1->tp_name);
7883PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
7885 if (&PyFloat_Type == Py_TYPE(operand2)) {
7886 return COMPARE_NE_OBJECT_FLOAT_FLOAT(operand1, operand2);
7889#if PYTHON_VERSION < 0x300
7890 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
7894 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
7899 PyTypeObject *type2 = Py_TYPE(operand2);
7901#if PYTHON_VERSION < 0x300
7903 if (&PyFloat_Type == type2 && !0) {
7905 richcmpfunc frich = PyFloat_Type.tp_richcompare;
7907 if (frich != NULL) {
7908 PyObject *result = (*frich)(operand1, operand2, Py_NE);
7910 if (result != Py_NotImplemented) {
7911 Py_LeaveRecursiveCall();
7916 Py_DECREF_IMMORTAL(result);
7920 cmpfunc fcmp = NULL;
7923 int c = (*fcmp)(operand1, operand2);
7924 c = adjust_tp_compare(c);
7926 Py_LeaveRecursiveCall();
7952 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
7956 PyObject *result = BOOL_FROM(r);
7957 Py_INCREF_IMMORTAL(result);
7965 if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
7966 f = TP_RICHCOMPARE(type2);
7969 PyObject *result = (*f)(operand2, operand1, Py_NE);
7971 if (result != Py_NotImplemented) {
7972 Py_LeaveRecursiveCall();
7977 Py_DECREF_IMMORTAL(result);
7981 f = PyFloat_Type.tp_richcompare;
7983 PyObject *result = (*f)(operand1, operand2, Py_NE);
7985 if (result != Py_NotImplemented) {
7986 Py_LeaveRecursiveCall();
7991 Py_DECREF_IMMORTAL(result);
7994 f = TP_RICHCOMPARE(type2);
7996 PyObject *result = (*f)(operand2, operand1, Py_NE);
7998 if (result != Py_NotImplemented) {
7999 Py_LeaveRecursiveCall();
8004 Py_DECREF_IMMORTAL(result);
8010 cmpfunc fcmp = NULL;
8011 c = (*fcmp)(operand1, operand2);
8012 }
else if (PyInstance_Check(operand2)) {
8013 cmpfunc fcmp = type2->tp_compare;
8014 c = (*fcmp)(operand1, operand2);
8016 c = try_3way_compare(operand1, operand2);
8020 if (&PyFloat_Type == type2) {
8021 Py_uintptr_t aa = (Py_uintptr_t)operand1;
8022 Py_uintptr_t bb = (Py_uintptr_t)operand2;
8024 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8025 }
else if (operand1 == Py_None) {
8028 }
else if (operand2 == Py_None) {
8031 }
else if (PyNumber_Check(operand1)) {
8034 if (PyNumber_Check(operand2)) {
8036 Py_uintptr_t aa = (Py_uintptr_t)&PyFloat_Type;
8037 Py_uintptr_t bb = (Py_uintptr_t)type2;
8039 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8043 }
else if (PyNumber_Check(operand2)) {
8047 int s = strcmp(
"float", type2->tp_name);
8055 Py_uintptr_t aa = (Py_uintptr_t)&PyFloat_Type;
8056 Py_uintptr_t bb = (Py_uintptr_t)type2;
8058 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8063 Py_LeaveRecursiveCall();
8065 if (unlikely(c <= -2)) {
8091 PyObject *result = BOOL_FROM(r);
8092 Py_INCREF_IMMORTAL(result);
8095 bool checked_reverse_op =
false;
8098 if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8099 f = TP_RICHCOMPARE(type2);
8102 checked_reverse_op =
true;
8104 PyObject *result = (*f)(operand2, operand1, Py_NE);
8106 if (result != Py_NotImplemented) {
8107 Py_LeaveRecursiveCall();
8112 Py_DECREF_IMMORTAL(result);
8116 f = PyFloat_Type.tp_richcompare;
8119 PyObject *result = (*f)(operand1, operand2, Py_NE);
8121 if (result != Py_NotImplemented) {
8122 Py_LeaveRecursiveCall();
8127 Py_DECREF_IMMORTAL(result);
8130 if (checked_reverse_op ==
false) {
8131 f = TP_RICHCOMPARE(type2);
8134 PyObject *result = (*f)(operand2, operand1, Py_NE);
8136 if (result != Py_NotImplemented) {
8137 Py_LeaveRecursiveCall();
8142 Py_DECREF_IMMORTAL(result);
8146 Py_LeaveRecursiveCall();
8152 bool r = operand1 == operand2;
8153 PyObject *result = BOOL_FROM(r);
8154 Py_INCREF_IMMORTAL(result);
8158 bool r = operand1 != operand2;
8159 PyObject *result = BOOL_FROM(r);
8160 Py_INCREF_IMMORTAL(result);
8164#if PYTHON_VERSION < 0x360
8165 PyErr_Format(PyExc_TypeError,
"unorderable types: float() != %s()", type2->tp_name);
8167 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'float' and '%s'", type2->tp_name);
8174static bool COMPARE_NE_CBOOL_FLOAT_FLOAT(PyObject *operand1, PyObject *operand2) {
8175 CHECK_OBJECT(operand1);
8176 assert(PyFloat_CheckExact(operand1));
8177 CHECK_OBJECT(operand2);
8178 assert(PyFloat_CheckExact(operand2));
8180 const double a = PyFloat_AS_DOUBLE(operand1);
8181 const double b = PyFloat_AS_DOUBLE(operand2);
8191nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *operand2) {
8193 if (Py_TYPE(operand1) == &PyFloat_Type) {
8194 return COMPARE_NE_CBOOL_FLOAT_FLOAT(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8197#if PYTHON_VERSION < 0x300
8198 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
8199 return NUITKA_BOOL_EXCEPTION;
8202 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
8203 return NUITKA_BOOL_EXCEPTION;
8207 PyTypeObject *type1 = Py_TYPE(operand1);
8209#if PYTHON_VERSION < 0x300
8211 if (type1 == &PyFloat_Type && !0) {
8213 richcmpfunc frich = PyFloat_Type.tp_richcompare;
8215 if (frich != NULL) {
8216 PyObject *result = (*frich)(operand1, operand2, Py_NE);
8218 if (result != Py_NotImplemented) {
8219 Py_LeaveRecursiveCall();
8221 if (unlikely(result == NULL)) {
8222 return NUITKA_BOOL_EXCEPTION;
8226 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8232 Py_DECREF_IMMORTAL(result);
8236 cmpfunc fcmp = NULL;
8239 int c = (*fcmp)(operand1, operand2);
8240 c = adjust_tp_compare(c);
8242 Py_LeaveRecursiveCall();
8245 return NUITKA_BOOL_EXCEPTION;
8268 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
8272 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8281 if (type1 != &PyFloat_Type && 0) {
8282 f = PyFloat_Type.tp_richcompare;
8285 PyObject *result = (*f)(operand2, operand1, Py_NE);
8287 if (result != Py_NotImplemented) {
8288 Py_LeaveRecursiveCall();
8290 if (unlikely(result == NULL)) {
8291 return NUITKA_BOOL_EXCEPTION;
8295 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8301 Py_DECREF_IMMORTAL(result);
8305 f = TP_RICHCOMPARE(type1);
8307 PyObject *result = (*f)(operand1, operand2, Py_NE);
8309 if (result != Py_NotImplemented) {
8310 Py_LeaveRecursiveCall();
8312 if (unlikely(result == NULL)) {
8313 return NUITKA_BOOL_EXCEPTION;
8317 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8323 Py_DECREF_IMMORTAL(result);
8326 f = PyFloat_Type.tp_richcompare;
8328 PyObject *result = (*f)(operand2, operand1, Py_NE);
8330 if (result != Py_NotImplemented) {
8331 Py_LeaveRecursiveCall();
8333 if (unlikely(result == NULL)) {
8334 return NUITKA_BOOL_EXCEPTION;
8338 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8344 Py_DECREF_IMMORTAL(result);
8349 if (PyInstance_Check(operand1)) {
8350 cmpfunc fcmp = type1->tp_compare;
8351 c = (*fcmp)(operand1, operand2);
8353 cmpfunc fcmp = NULL;
8354 c = (*fcmp)(operand1, operand2);
8356 c = try_3way_compare(operand1, operand2);
8360 if (type1 == &PyFloat_Type) {
8361 Py_uintptr_t aa = (Py_uintptr_t)operand1;
8362 Py_uintptr_t bb = (Py_uintptr_t)operand2;
8364 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8365 }
else if (operand1 == Py_None) {
8368 }
else if (operand2 == Py_None) {
8371 }
else if (PyNumber_Check(operand1)) {
8374 if (PyNumber_Check(operand2)) {
8376 Py_uintptr_t aa = (Py_uintptr_t)type1;
8377 Py_uintptr_t bb = (Py_uintptr_t)&PyFloat_Type;
8379 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8383 }
else if (PyNumber_Check(operand2)) {
8387 int s = strcmp(type1->tp_name,
"float");
8395 Py_uintptr_t aa = (Py_uintptr_t)type1;
8396 Py_uintptr_t bb = (Py_uintptr_t)&PyFloat_Type;
8398 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8403 Py_LeaveRecursiveCall();
8405 if (unlikely(c <= -2)) {
8406 return NUITKA_BOOL_EXCEPTION;
8431 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8435 bool checked_reverse_op =
false;
8438 if (type1 != &PyFloat_Type && Nuitka_Type_IsSubtype(&PyFloat_Type, type1)) {
8439 f = PyFloat_Type.tp_richcompare;
8442 checked_reverse_op =
true;
8444 PyObject *result = (*f)(operand2, operand1, Py_NE);
8446 if (result != Py_NotImplemented) {
8447 Py_LeaveRecursiveCall();
8449 if (unlikely(result == NULL)) {
8450 return NUITKA_BOOL_EXCEPTION;
8454 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8460 Py_DECREF_IMMORTAL(result);
8464 f = TP_RICHCOMPARE(type1);
8467 PyObject *result = (*f)(operand1, operand2, Py_NE);
8469 if (result != Py_NotImplemented) {
8470 Py_LeaveRecursiveCall();
8472 if (unlikely(result == NULL)) {
8473 return NUITKA_BOOL_EXCEPTION;
8477 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8483 Py_DECREF_IMMORTAL(result);
8486 if (checked_reverse_op ==
false) {
8487 f = PyFloat_Type.tp_richcompare;
8490 PyObject *result = (*f)(operand2, operand1, Py_NE);
8492 if (result != Py_NotImplemented) {
8493 Py_LeaveRecursiveCall();
8495 if (unlikely(result == NULL)) {
8496 return NUITKA_BOOL_EXCEPTION;
8500 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8506 Py_DECREF_IMMORTAL(result);
8510 Py_LeaveRecursiveCall();
8516 bool r = operand1 == operand2;
8517 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8522 bool r = operand1 != operand2;
8523 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8528#if PYTHON_VERSION < 0x360
8529 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != float()", type1->tp_name);
8531 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'float'", type1->tp_name);
8533 return NUITKA_BOOL_EXCEPTION;
8539nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *operand2) {
8541 if (&PyFloat_Type == Py_TYPE(operand2)) {
8542 return COMPARE_NE_CBOOL_FLOAT_FLOAT(operand1, operand2) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8545#if PYTHON_VERSION < 0x300
8546 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
8547 return NUITKA_BOOL_EXCEPTION;
8550 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
8551 return NUITKA_BOOL_EXCEPTION;
8555 PyTypeObject *type2 = Py_TYPE(operand2);
8557#if PYTHON_VERSION < 0x300
8559 if (&PyFloat_Type == type2 && !0) {
8561 richcmpfunc frich = PyFloat_Type.tp_richcompare;
8563 if (frich != NULL) {
8564 PyObject *result = (*frich)(operand1, operand2, Py_NE);
8566 if (result != Py_NotImplemented) {
8567 Py_LeaveRecursiveCall();
8569 if (unlikely(result == NULL)) {
8570 return NUITKA_BOOL_EXCEPTION;
8574 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8580 Py_DECREF_IMMORTAL(result);
8584 cmpfunc fcmp = NULL;
8587 int c = (*fcmp)(operand1, operand2);
8588 c = adjust_tp_compare(c);
8590 Py_LeaveRecursiveCall();
8593 return NUITKA_BOOL_EXCEPTION;
8616 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
8620 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8629 if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8630 f = TP_RICHCOMPARE(type2);
8633 PyObject *result = (*f)(operand2, operand1, Py_NE);
8635 if (result != Py_NotImplemented) {
8636 Py_LeaveRecursiveCall();
8638 if (unlikely(result == NULL)) {
8639 return NUITKA_BOOL_EXCEPTION;
8643 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8649 Py_DECREF_IMMORTAL(result);
8653 f = PyFloat_Type.tp_richcompare;
8655 PyObject *result = (*f)(operand1, operand2, Py_NE);
8657 if (result != Py_NotImplemented) {
8658 Py_LeaveRecursiveCall();
8660 if (unlikely(result == NULL)) {
8661 return NUITKA_BOOL_EXCEPTION;
8665 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8671 Py_DECREF_IMMORTAL(result);
8674 f = TP_RICHCOMPARE(type2);
8676 PyObject *result = (*f)(operand2, operand1, Py_NE);
8678 if (result != Py_NotImplemented) {
8679 Py_LeaveRecursiveCall();
8681 if (unlikely(result == NULL)) {
8682 return NUITKA_BOOL_EXCEPTION;
8686 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8692 Py_DECREF_IMMORTAL(result);
8698 cmpfunc fcmp = NULL;
8699 c = (*fcmp)(operand1, operand2);
8700 }
else if (PyInstance_Check(operand2)) {
8701 cmpfunc fcmp = type2->tp_compare;
8702 c = (*fcmp)(operand1, operand2);
8704 c = try_3way_compare(operand1, operand2);
8708 if (&PyFloat_Type == type2) {
8709 Py_uintptr_t aa = (Py_uintptr_t)operand1;
8710 Py_uintptr_t bb = (Py_uintptr_t)operand2;
8712 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8713 }
else if (operand1 == Py_None) {
8716 }
else if (operand2 == Py_None) {
8719 }
else if (PyNumber_Check(operand1)) {
8722 if (PyNumber_Check(operand2)) {
8724 Py_uintptr_t aa = (Py_uintptr_t)&PyFloat_Type;
8725 Py_uintptr_t bb = (Py_uintptr_t)type2;
8727 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8731 }
else if (PyNumber_Check(operand2)) {
8735 int s = strcmp(
"float", type2->tp_name);
8743 Py_uintptr_t aa = (Py_uintptr_t)&PyFloat_Type;
8744 Py_uintptr_t bb = (Py_uintptr_t)type2;
8746 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
8751 Py_LeaveRecursiveCall();
8753 if (unlikely(c <= -2)) {
8754 return NUITKA_BOOL_EXCEPTION;
8779 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8783 bool checked_reverse_op =
false;
8786 if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8787 f = TP_RICHCOMPARE(type2);
8790 checked_reverse_op =
true;
8792 PyObject *result = (*f)(operand2, operand1, Py_NE);
8794 if (result != Py_NotImplemented) {
8795 Py_LeaveRecursiveCall();
8797 if (unlikely(result == NULL)) {
8798 return NUITKA_BOOL_EXCEPTION;
8802 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8808 Py_DECREF_IMMORTAL(result);
8812 f = PyFloat_Type.tp_richcompare;
8815 PyObject *result = (*f)(operand1, operand2, Py_NE);
8817 if (result != Py_NotImplemented) {
8818 Py_LeaveRecursiveCall();
8820 if (unlikely(result == NULL)) {
8821 return NUITKA_BOOL_EXCEPTION;
8825 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8831 Py_DECREF_IMMORTAL(result);
8834 if (checked_reverse_op ==
false) {
8835 f = TP_RICHCOMPARE(type2);
8838 PyObject *result = (*f)(operand2, operand1, Py_NE);
8840 if (result != Py_NotImplemented) {
8841 Py_LeaveRecursiveCall();
8843 if (unlikely(result == NULL)) {
8844 return NUITKA_BOOL_EXCEPTION;
8848 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8854 Py_DECREF_IMMORTAL(result);
8858 Py_LeaveRecursiveCall();
8864 bool r = operand1 == operand2;
8865 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8870 bool r = operand1 != operand2;
8871 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
8876#if PYTHON_VERSION < 0x360
8877 PyErr_Format(PyExc_TypeError,
"unorderable types: float() != %s()", type2->tp_name);
8879 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'float' and '%s'", type2->tp_name);
8881 return NUITKA_BOOL_EXCEPTION;
8886static PyObject *COMPARE_NE_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *operand2) {
8887 CHECK_OBJECT(operand1);
8888 assert(PyTuple_CheckExact(operand1));
8889 CHECK_OBJECT(operand2);
8890 assert(PyTuple_CheckExact(operand2));
8892 PyTupleObject *a = (PyTupleObject *)operand1;
8893 PyTupleObject *b = (PyTupleObject *)operand2;
8895 Py_ssize_t len_a = Py_SIZE(a);
8896 Py_ssize_t len_b = Py_SIZE(b);
8898 if (len_a != len_b) {
8902 PyObject *result = BOOL_FROM(r);
8903 Py_INCREF_IMMORTAL(result);
8907 nuitka_bool res = NUITKA_BOOL_TRUE;
8910 for (i = 0; i < len_a && i < len_b; i++) {
8911 PyObject *aa = a->ob_item[i];
8912 PyObject *bb = b->ob_item[i];
8918 res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
8920 if (res == NUITKA_BOOL_EXCEPTION) {
8924 if (res == NUITKA_BOOL_FALSE) {
8929 bool r = res == NUITKA_BOOL_FALSE;
8932 PyObject *result = BOOL_FROM(r);
8933 Py_INCREF_IMMORTAL(result);
8937PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *operand2) {
8939 if (Py_TYPE(operand1) == &PyTuple_Type) {
8940 return COMPARE_NE_OBJECT_TUPLE_TUPLE(operand1, operand2);
8943#if PYTHON_VERSION < 0x300
8944 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
8948 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
8953 PyTypeObject *type1 = Py_TYPE(operand1);
8955#if PYTHON_VERSION < 0x300
8957 if (type1 == &PyTuple_Type && !0) {
8959 richcmpfunc frich = PyTuple_Type.tp_richcompare;
8961 if (frich != NULL) {
8962 PyObject *result = (*frich)(operand1, operand2, Py_NE);
8964 if (result != Py_NotImplemented) {
8965 Py_LeaveRecursiveCall();
8970 Py_DECREF_IMMORTAL(result);
8974 cmpfunc fcmp = NULL;
8977 int c = (*fcmp)(operand1, operand2);
8978 c = adjust_tp_compare(c);
8980 Py_LeaveRecursiveCall();
9006 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
9010 PyObject *result = BOOL_FROM(r);
9011 Py_INCREF_IMMORTAL(result);
9019 if (type1 != &PyTuple_Type && 0) {
9020 f = PyTuple_Type.tp_richcompare;
9023 PyObject *result = (*f)(operand2, operand1, Py_NE);
9025 if (result != Py_NotImplemented) {
9026 Py_LeaveRecursiveCall();
9031 Py_DECREF_IMMORTAL(result);
9035 f = TP_RICHCOMPARE(type1);
9037 PyObject *result = (*f)(operand1, operand2, Py_NE);
9039 if (result != Py_NotImplemented) {
9040 Py_LeaveRecursiveCall();
9045 Py_DECREF_IMMORTAL(result);
9048 f = PyTuple_Type.tp_richcompare;
9050 PyObject *result = (*f)(operand2, operand1, Py_NE);
9052 if (result != Py_NotImplemented) {
9053 Py_LeaveRecursiveCall();
9058 Py_DECREF_IMMORTAL(result);
9063 if (PyInstance_Check(operand1)) {
9064 cmpfunc fcmp = type1->tp_compare;
9065 c = (*fcmp)(operand1, operand2);
9067 cmpfunc fcmp = NULL;
9068 c = (*fcmp)(operand1, operand2);
9070 c = try_3way_compare(operand1, operand2);
9074 if (type1 == &PyTuple_Type) {
9075 Py_uintptr_t aa = (Py_uintptr_t)operand1;
9076 Py_uintptr_t bb = (Py_uintptr_t)operand2;
9078 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9079 }
else if (operand1 == Py_None) {
9082 }
else if (operand2 == Py_None) {
9085 }
else if (PyNumber_Check(operand1)) {
9088 if (PyNumber_Check(operand2)) {
9090 Py_uintptr_t aa = (Py_uintptr_t)type1;
9091 Py_uintptr_t bb = (Py_uintptr_t)&PyTuple_Type;
9093 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9097 }
else if (PyNumber_Check(operand2)) {
9101 int s = strcmp(type1->tp_name,
"tuple");
9109 Py_uintptr_t aa = (Py_uintptr_t)type1;
9110 Py_uintptr_t bb = (Py_uintptr_t)&PyTuple_Type;
9112 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9117 Py_LeaveRecursiveCall();
9119 if (unlikely(c <= -2)) {
9145 PyObject *result = BOOL_FROM(r);
9146 Py_INCREF_IMMORTAL(result);
9149 bool checked_reverse_op =
false;
9152 if (type1 != &PyTuple_Type && Nuitka_Type_IsSubtype(&PyTuple_Type, type1)) {
9153 f = PyTuple_Type.tp_richcompare;
9156 checked_reverse_op =
true;
9158 PyObject *result = (*f)(operand2, operand1, Py_NE);
9160 if (result != Py_NotImplemented) {
9161 Py_LeaveRecursiveCall();
9166 Py_DECREF_IMMORTAL(result);
9170 f = TP_RICHCOMPARE(type1);
9173 PyObject *result = (*f)(operand1, operand2, Py_NE);
9175 if (result != Py_NotImplemented) {
9176 Py_LeaveRecursiveCall();
9181 Py_DECREF_IMMORTAL(result);
9184 if (checked_reverse_op ==
false) {
9185 f = PyTuple_Type.tp_richcompare;
9188 PyObject *result = (*f)(operand2, operand1, Py_NE);
9190 if (result != Py_NotImplemented) {
9191 Py_LeaveRecursiveCall();
9196 Py_DECREF_IMMORTAL(result);
9200 Py_LeaveRecursiveCall();
9206 bool r = operand1 == operand2;
9207 PyObject *result = BOOL_FROM(r);
9208 Py_INCREF_IMMORTAL(result);
9212 bool r = operand1 != operand2;
9213 PyObject *result = BOOL_FROM(r);
9214 Py_INCREF_IMMORTAL(result);
9218#if PYTHON_VERSION < 0x360
9219 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != tuple()", type1->tp_name);
9221 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'tuple'", type1->tp_name);
9229PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *operand2) {
9231 if (&PyTuple_Type == Py_TYPE(operand2)) {
9232 return COMPARE_NE_OBJECT_TUPLE_TUPLE(operand1, operand2);
9235#if PYTHON_VERSION < 0x300
9236 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
9240 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
9245 PyTypeObject *type2 = Py_TYPE(operand2);
9247#if PYTHON_VERSION < 0x300
9249 if (&PyTuple_Type == type2 && !0) {
9251 richcmpfunc frich = PyTuple_Type.tp_richcompare;
9253 if (frich != NULL) {
9254 PyObject *result = (*frich)(operand1, operand2, Py_NE);
9256 if (result != Py_NotImplemented) {
9257 Py_LeaveRecursiveCall();
9262 Py_DECREF_IMMORTAL(result);
9266 cmpfunc fcmp = NULL;
9269 int c = (*fcmp)(operand1, operand2);
9270 c = adjust_tp_compare(c);
9272 Py_LeaveRecursiveCall();
9298 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
9302 PyObject *result = BOOL_FROM(r);
9303 Py_INCREF_IMMORTAL(result);
9311 if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9312 f = TP_RICHCOMPARE(type2);
9315 PyObject *result = (*f)(operand2, operand1, Py_NE);
9317 if (result != Py_NotImplemented) {
9318 Py_LeaveRecursiveCall();
9323 Py_DECREF_IMMORTAL(result);
9327 f = PyTuple_Type.tp_richcompare;
9329 PyObject *result = (*f)(operand1, operand2, Py_NE);
9331 if (result != Py_NotImplemented) {
9332 Py_LeaveRecursiveCall();
9337 Py_DECREF_IMMORTAL(result);
9340 f = TP_RICHCOMPARE(type2);
9342 PyObject *result = (*f)(operand2, operand1, Py_NE);
9344 if (result != Py_NotImplemented) {
9345 Py_LeaveRecursiveCall();
9350 Py_DECREF_IMMORTAL(result);
9356 cmpfunc fcmp = NULL;
9357 c = (*fcmp)(operand1, operand2);
9358 }
else if (PyInstance_Check(operand2)) {
9359 cmpfunc fcmp = type2->tp_compare;
9360 c = (*fcmp)(operand1, operand2);
9362 c = try_3way_compare(operand1, operand2);
9366 if (&PyTuple_Type == type2) {
9367 Py_uintptr_t aa = (Py_uintptr_t)operand1;
9368 Py_uintptr_t bb = (Py_uintptr_t)operand2;
9370 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9371 }
else if (operand1 == Py_None) {
9374 }
else if (operand2 == Py_None) {
9377 }
else if (PyNumber_Check(operand1)) {
9380 if (PyNumber_Check(operand2)) {
9382 Py_uintptr_t aa = (Py_uintptr_t)&PyTuple_Type;
9383 Py_uintptr_t bb = (Py_uintptr_t)type2;
9385 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9389 }
else if (PyNumber_Check(operand2)) {
9393 int s = strcmp(
"tuple", type2->tp_name);
9401 Py_uintptr_t aa = (Py_uintptr_t)&PyTuple_Type;
9402 Py_uintptr_t bb = (Py_uintptr_t)type2;
9404 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9409 Py_LeaveRecursiveCall();
9411 if (unlikely(c <= -2)) {
9437 PyObject *result = BOOL_FROM(r);
9438 Py_INCREF_IMMORTAL(result);
9441 bool checked_reverse_op =
false;
9444 if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9445 f = TP_RICHCOMPARE(type2);
9448 checked_reverse_op =
true;
9450 PyObject *result = (*f)(operand2, operand1, Py_NE);
9452 if (result != Py_NotImplemented) {
9453 Py_LeaveRecursiveCall();
9458 Py_DECREF_IMMORTAL(result);
9462 f = PyTuple_Type.tp_richcompare;
9465 PyObject *result = (*f)(operand1, operand2, Py_NE);
9467 if (result != Py_NotImplemented) {
9468 Py_LeaveRecursiveCall();
9473 Py_DECREF_IMMORTAL(result);
9476 if (checked_reverse_op ==
false) {
9477 f = TP_RICHCOMPARE(type2);
9480 PyObject *result = (*f)(operand2, operand1, Py_NE);
9482 if (result != Py_NotImplemented) {
9483 Py_LeaveRecursiveCall();
9488 Py_DECREF_IMMORTAL(result);
9492 Py_LeaveRecursiveCall();
9498 bool r = operand1 == operand2;
9499 PyObject *result = BOOL_FROM(r);
9500 Py_INCREF_IMMORTAL(result);
9504 bool r = operand1 != operand2;
9505 PyObject *result = BOOL_FROM(r);
9506 Py_INCREF_IMMORTAL(result);
9510#if PYTHON_VERSION < 0x360
9511 PyErr_Format(PyExc_TypeError,
"unorderable types: tuple() != %s()", type2->tp_name);
9513 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'tuple' and '%s'", type2->tp_name);
9521PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *operand2) {
9523 return COMPARE_NE_OBJECT_TUPLE_TUPLE(operand1, operand2);
9526static nuitka_bool COMPARE_NE_NBOOL_TUPLE_TUPLE(PyObject *operand1, PyObject *operand2) {
9527 CHECK_OBJECT(operand1);
9528 assert(PyTuple_CheckExact(operand1));
9529 CHECK_OBJECT(operand2);
9530 assert(PyTuple_CheckExact(operand2));
9532 PyTupleObject *a = (PyTupleObject *)operand1;
9533 PyTupleObject *b = (PyTupleObject *)operand2;
9535 Py_ssize_t len_a = Py_SIZE(a);
9536 Py_ssize_t len_b = Py_SIZE(b);
9538 if (len_a != len_b) {
9542 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9547 nuitka_bool res = NUITKA_BOOL_TRUE;
9550 for (i = 0; i < len_a && i < len_b; i++) {
9551 PyObject *aa = a->ob_item[i];
9552 PyObject *bb = b->ob_item[i];
9558 res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
9560 if (res == NUITKA_BOOL_EXCEPTION) {
9561 return NUITKA_BOOL_EXCEPTION;
9564 if (res == NUITKA_BOOL_FALSE) {
9569 bool r = res == NUITKA_BOOL_FALSE;
9572 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9577nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *operand2) {
9579 if (Py_TYPE(operand1) == &PyTuple_Type) {
9580 return COMPARE_NE_NBOOL_TUPLE_TUPLE(operand1, operand2);
9583#if PYTHON_VERSION < 0x300
9584 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
9585 return NUITKA_BOOL_EXCEPTION;
9588 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
9589 return NUITKA_BOOL_EXCEPTION;
9593 PyTypeObject *type1 = Py_TYPE(operand1);
9595#if PYTHON_VERSION < 0x300
9597 if (type1 == &PyTuple_Type && !0) {
9599 richcmpfunc frich = PyTuple_Type.tp_richcompare;
9601 if (frich != NULL) {
9602 PyObject *result = (*frich)(operand1, operand2, Py_NE);
9604 if (result != Py_NotImplemented) {
9605 Py_LeaveRecursiveCall();
9607 if (unlikely(result == NULL)) {
9608 return NUITKA_BOOL_EXCEPTION;
9612 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9618 Py_DECREF_IMMORTAL(result);
9622 cmpfunc fcmp = NULL;
9625 int c = (*fcmp)(operand1, operand2);
9626 c = adjust_tp_compare(c);
9628 Py_LeaveRecursiveCall();
9631 return NUITKA_BOOL_EXCEPTION;
9654 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
9658 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9667 if (type1 != &PyTuple_Type && 0) {
9668 f = PyTuple_Type.tp_richcompare;
9671 PyObject *result = (*f)(operand2, operand1, Py_NE);
9673 if (result != Py_NotImplemented) {
9674 Py_LeaveRecursiveCall();
9676 if (unlikely(result == NULL)) {
9677 return NUITKA_BOOL_EXCEPTION;
9681 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9687 Py_DECREF_IMMORTAL(result);
9691 f = TP_RICHCOMPARE(type1);
9693 PyObject *result = (*f)(operand1, operand2, Py_NE);
9695 if (result != Py_NotImplemented) {
9696 Py_LeaveRecursiveCall();
9698 if (unlikely(result == NULL)) {
9699 return NUITKA_BOOL_EXCEPTION;
9703 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9709 Py_DECREF_IMMORTAL(result);
9712 f = PyTuple_Type.tp_richcompare;
9714 PyObject *result = (*f)(operand2, operand1, Py_NE);
9716 if (result != Py_NotImplemented) {
9717 Py_LeaveRecursiveCall();
9719 if (unlikely(result == NULL)) {
9720 return NUITKA_BOOL_EXCEPTION;
9724 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9730 Py_DECREF_IMMORTAL(result);
9735 if (PyInstance_Check(operand1)) {
9736 cmpfunc fcmp = type1->tp_compare;
9737 c = (*fcmp)(operand1, operand2);
9739 cmpfunc fcmp = NULL;
9740 c = (*fcmp)(operand1, operand2);
9742 c = try_3way_compare(operand1, operand2);
9746 if (type1 == &PyTuple_Type) {
9747 Py_uintptr_t aa = (Py_uintptr_t)operand1;
9748 Py_uintptr_t bb = (Py_uintptr_t)operand2;
9750 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9751 }
else if (operand1 == Py_None) {
9754 }
else if (operand2 == Py_None) {
9757 }
else if (PyNumber_Check(operand1)) {
9760 if (PyNumber_Check(operand2)) {
9762 Py_uintptr_t aa = (Py_uintptr_t)type1;
9763 Py_uintptr_t bb = (Py_uintptr_t)&PyTuple_Type;
9765 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9769 }
else if (PyNumber_Check(operand2)) {
9773 int s = strcmp(type1->tp_name,
"tuple");
9781 Py_uintptr_t aa = (Py_uintptr_t)type1;
9782 Py_uintptr_t bb = (Py_uintptr_t)&PyTuple_Type;
9784 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
9789 Py_LeaveRecursiveCall();
9791 if (unlikely(c <= -2)) {
9792 return NUITKA_BOOL_EXCEPTION;
9817 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9821 bool checked_reverse_op =
false;
9824 if (type1 != &PyTuple_Type && Nuitka_Type_IsSubtype(&PyTuple_Type, type1)) {
9825 f = PyTuple_Type.tp_richcompare;
9828 checked_reverse_op =
true;
9830 PyObject *result = (*f)(operand2, operand1, Py_NE);
9832 if (result != Py_NotImplemented) {
9833 Py_LeaveRecursiveCall();
9835 if (unlikely(result == NULL)) {
9836 return NUITKA_BOOL_EXCEPTION;
9840 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9846 Py_DECREF_IMMORTAL(result);
9850 f = TP_RICHCOMPARE(type1);
9853 PyObject *result = (*f)(operand1, operand2, Py_NE);
9855 if (result != Py_NotImplemented) {
9856 Py_LeaveRecursiveCall();
9858 if (unlikely(result == NULL)) {
9859 return NUITKA_BOOL_EXCEPTION;
9863 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9869 Py_DECREF_IMMORTAL(result);
9872 if (checked_reverse_op ==
false) {
9873 f = PyTuple_Type.tp_richcompare;
9876 PyObject *result = (*f)(operand2, operand1, Py_NE);
9878 if (result != Py_NotImplemented) {
9879 Py_LeaveRecursiveCall();
9881 if (unlikely(result == NULL)) {
9882 return NUITKA_BOOL_EXCEPTION;
9886 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9892 Py_DECREF_IMMORTAL(result);
9896 Py_LeaveRecursiveCall();
9902 bool r = operand1 == operand2;
9903 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9908 bool r = operand1 != operand2;
9909 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9914#if PYTHON_VERSION < 0x360
9915 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != tuple()", type1->tp_name);
9917 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'tuple'", type1->tp_name);
9919 return NUITKA_BOOL_EXCEPTION;
9925nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *operand2) {
9927 if (&PyTuple_Type == Py_TYPE(operand2)) {
9928 return COMPARE_NE_NBOOL_TUPLE_TUPLE(operand1, operand2);
9931#if PYTHON_VERSION < 0x300
9932 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
9933 return NUITKA_BOOL_EXCEPTION;
9936 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
9937 return NUITKA_BOOL_EXCEPTION;
9941 PyTypeObject *type2 = Py_TYPE(operand2);
9943#if PYTHON_VERSION < 0x300
9945 if (&PyTuple_Type == type2 && !0) {
9947 richcmpfunc frich = PyTuple_Type.tp_richcompare;
9949 if (frich != NULL) {
9950 PyObject *result = (*frich)(operand1, operand2, Py_NE);
9952 if (result != Py_NotImplemented) {
9953 Py_LeaveRecursiveCall();
9955 if (unlikely(result == NULL)) {
9956 return NUITKA_BOOL_EXCEPTION;
9960 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
9966 Py_DECREF_IMMORTAL(result);
9970 cmpfunc fcmp = NULL;
9973 int c = (*fcmp)(operand1, operand2);
9974 c = adjust_tp_compare(c);
9976 Py_LeaveRecursiveCall();
9979 return NUITKA_BOOL_EXCEPTION;
10002 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
10006 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10015 if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
10016 f = TP_RICHCOMPARE(type2);
10019 PyObject *result = (*f)(operand2, operand1, Py_NE);
10021 if (result != Py_NotImplemented) {
10022 Py_LeaveRecursiveCall();
10024 if (unlikely(result == NULL)) {
10025 return NUITKA_BOOL_EXCEPTION;
10029 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10035 Py_DECREF_IMMORTAL(result);
10039 f = PyTuple_Type.tp_richcompare;
10041 PyObject *result = (*f)(operand1, operand2, Py_NE);
10043 if (result != Py_NotImplemented) {
10044 Py_LeaveRecursiveCall();
10046 if (unlikely(result == NULL)) {
10047 return NUITKA_BOOL_EXCEPTION;
10051 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10057 Py_DECREF_IMMORTAL(result);
10060 f = TP_RICHCOMPARE(type2);
10062 PyObject *result = (*f)(operand2, operand1, Py_NE);
10064 if (result != Py_NotImplemented) {
10065 Py_LeaveRecursiveCall();
10067 if (unlikely(result == NULL)) {
10068 return NUITKA_BOOL_EXCEPTION;
10072 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10078 Py_DECREF_IMMORTAL(result);
10084 cmpfunc fcmp = NULL;
10085 c = (*fcmp)(operand1, operand2);
10086 }
else if (PyInstance_Check(operand2)) {
10087 cmpfunc fcmp = type2->tp_compare;
10088 c = (*fcmp)(operand1, operand2);
10090 c = try_3way_compare(operand1, operand2);
10094 if (&PyTuple_Type == type2) {
10095 Py_uintptr_t aa = (Py_uintptr_t)operand1;
10096 Py_uintptr_t bb = (Py_uintptr_t)operand2;
10098 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10099 }
else if (operand1 == Py_None) {
10102 }
else if (operand2 == Py_None) {
10105 }
else if (PyNumber_Check(operand1)) {
10108 if (PyNumber_Check(operand2)) {
10110 Py_uintptr_t aa = (Py_uintptr_t)&PyTuple_Type;
10111 Py_uintptr_t bb = (Py_uintptr_t)type2;
10113 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10117 }
else if (PyNumber_Check(operand2)) {
10121 int s = strcmp(
"tuple", type2->tp_name);
10125 }
else if (s > 0) {
10129 Py_uintptr_t aa = (Py_uintptr_t)&PyTuple_Type;
10130 Py_uintptr_t bb = (Py_uintptr_t)type2;
10132 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10137 Py_LeaveRecursiveCall();
10139 if (unlikely(c <= -2)) {
10140 return NUITKA_BOOL_EXCEPTION;
10165 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10169 bool checked_reverse_op =
false;
10172 if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
10173 f = TP_RICHCOMPARE(type2);
10176 checked_reverse_op =
true;
10178 PyObject *result = (*f)(operand2, operand1, Py_NE);
10180 if (result != Py_NotImplemented) {
10181 Py_LeaveRecursiveCall();
10183 if (unlikely(result == NULL)) {
10184 return NUITKA_BOOL_EXCEPTION;
10188 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10194 Py_DECREF_IMMORTAL(result);
10198 f = PyTuple_Type.tp_richcompare;
10201 PyObject *result = (*f)(operand1, operand2, Py_NE);
10203 if (result != Py_NotImplemented) {
10204 Py_LeaveRecursiveCall();
10206 if (unlikely(result == NULL)) {
10207 return NUITKA_BOOL_EXCEPTION;
10211 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10217 Py_DECREF_IMMORTAL(result);
10220 if (checked_reverse_op ==
false) {
10221 f = TP_RICHCOMPARE(type2);
10224 PyObject *result = (*f)(operand2, operand1, Py_NE);
10226 if (result != Py_NotImplemented) {
10227 Py_LeaveRecursiveCall();
10229 if (unlikely(result == NULL)) {
10230 return NUITKA_BOOL_EXCEPTION;
10234 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10240 Py_DECREF_IMMORTAL(result);
10244 Py_LeaveRecursiveCall();
10250 bool r = operand1 == operand2;
10251 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10256 bool r = operand1 != operand2;
10257 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10262#if PYTHON_VERSION < 0x360
10263 PyErr_Format(PyExc_TypeError,
"unorderable types: tuple() != %s()", type2->tp_name);
10265 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'tuple' and '%s'", type2->tp_name);
10267 return NUITKA_BOOL_EXCEPTION;
10273nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_TUPLE(PyObject *operand1, PyObject *operand2) {
10275 return COMPARE_NE_NBOOL_TUPLE_TUPLE(operand1, operand2);
10278static PyObject *COMPARE_NE_OBJECT_LIST_LIST(PyObject *operand1, PyObject *operand2) {
10279 CHECK_OBJECT(operand1);
10280 assert(PyList_CheckExact(operand1));
10281 CHECK_OBJECT(operand2);
10282 assert(PyList_CheckExact(operand2));
10284 PyListObject *a = (PyListObject *)operand1;
10285 PyListObject *b = (PyListObject *)operand2;
10287 if (Py_SIZE(a) != Py_SIZE(b)) {
10291 PyObject *result = BOOL_FROM(r);
10292 Py_INCREF_IMMORTAL(result);
10296 nuitka_bool res = NUITKA_BOOL_TRUE;
10299 for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
10300 PyObject *aa = a->ob_item[i];
10301 PyObject *bb = b->ob_item[i];
10309 res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
10313 if (res == NUITKA_BOOL_EXCEPTION) {
10317 if (res == NUITKA_BOOL_FALSE) {
10324 if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
10325 r = Py_SIZE(a) != Py_SIZE(b);
10327 r = res == NUITKA_BOOL_FALSE;
10331 PyObject *result = BOOL_FROM(r);
10332 Py_INCREF_IMMORTAL(result);
10336PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *operand2) {
10338 if (Py_TYPE(operand1) == &PyList_Type) {
10339 return COMPARE_NE_OBJECT_LIST_LIST(operand1, operand2);
10342#if PYTHON_VERSION < 0x300
10343 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
10347 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
10352 PyTypeObject *type1 = Py_TYPE(operand1);
10354#if PYTHON_VERSION < 0x300
10356 if (type1 == &PyList_Type && !0) {
10358 richcmpfunc frich = PyList_Type.tp_richcompare;
10360 if (frich != NULL) {
10361 PyObject *result = (*frich)(operand1, operand2, Py_NE);
10363 if (result != Py_NotImplemented) {
10364 Py_LeaveRecursiveCall();
10369 Py_DECREF_IMMORTAL(result);
10373 cmpfunc fcmp = NULL;
10375 if (fcmp != NULL) {
10376 int c = (*fcmp)(operand1, operand2);
10377 c = adjust_tp_compare(c);
10379 Py_LeaveRecursiveCall();
10405 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
10409 PyObject *result = BOOL_FROM(r);
10410 Py_INCREF_IMMORTAL(result);
10418 if (type1 != &PyList_Type && 0) {
10419 f = PyList_Type.tp_richcompare;
10422 PyObject *result = (*f)(operand2, operand1, Py_NE);
10424 if (result != Py_NotImplemented) {
10425 Py_LeaveRecursiveCall();
10430 Py_DECREF_IMMORTAL(result);
10434 f = TP_RICHCOMPARE(type1);
10436 PyObject *result = (*f)(operand1, operand2, Py_NE);
10438 if (result != Py_NotImplemented) {
10439 Py_LeaveRecursiveCall();
10444 Py_DECREF_IMMORTAL(result);
10447 f = PyList_Type.tp_richcompare;
10449 PyObject *result = (*f)(operand2, operand1, Py_NE);
10451 if (result != Py_NotImplemented) {
10452 Py_LeaveRecursiveCall();
10457 Py_DECREF_IMMORTAL(result);
10462 if (PyInstance_Check(operand1)) {
10463 cmpfunc fcmp = type1->tp_compare;
10464 c = (*fcmp)(operand1, operand2);
10466 cmpfunc fcmp = NULL;
10467 c = (*fcmp)(operand1, operand2);
10469 c = try_3way_compare(operand1, operand2);
10473 if (type1 == &PyList_Type) {
10474 Py_uintptr_t aa = (Py_uintptr_t)operand1;
10475 Py_uintptr_t bb = (Py_uintptr_t)operand2;
10477 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10478 }
else if (operand1 == Py_None) {
10481 }
else if (operand2 == Py_None) {
10484 }
else if (PyNumber_Check(operand1)) {
10487 if (PyNumber_Check(operand2)) {
10489 Py_uintptr_t aa = (Py_uintptr_t)type1;
10490 Py_uintptr_t bb = (Py_uintptr_t)&PyList_Type;
10492 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10496 }
else if (PyNumber_Check(operand2)) {
10500 int s = strcmp(type1->tp_name,
"list");
10504 }
else if (s > 0) {
10508 Py_uintptr_t aa = (Py_uintptr_t)type1;
10509 Py_uintptr_t bb = (Py_uintptr_t)&PyList_Type;
10511 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10516 Py_LeaveRecursiveCall();
10518 if (unlikely(c <= -2)) {
10544 PyObject *result = BOOL_FROM(r);
10545 Py_INCREF_IMMORTAL(result);
10548 bool checked_reverse_op =
false;
10551 if (type1 != &PyList_Type && Nuitka_Type_IsSubtype(&PyList_Type, type1)) {
10552 f = PyList_Type.tp_richcompare;
10555 checked_reverse_op =
true;
10557 PyObject *result = (*f)(operand2, operand1, Py_NE);
10559 if (result != Py_NotImplemented) {
10560 Py_LeaveRecursiveCall();
10565 Py_DECREF_IMMORTAL(result);
10569 f = TP_RICHCOMPARE(type1);
10572 PyObject *result = (*f)(operand1, operand2, Py_NE);
10574 if (result != Py_NotImplemented) {
10575 Py_LeaveRecursiveCall();
10580 Py_DECREF_IMMORTAL(result);
10583 if (checked_reverse_op ==
false) {
10584 f = PyList_Type.tp_richcompare;
10587 PyObject *result = (*f)(operand2, operand1, Py_NE);
10589 if (result != Py_NotImplemented) {
10590 Py_LeaveRecursiveCall();
10595 Py_DECREF_IMMORTAL(result);
10599 Py_LeaveRecursiveCall();
10605 bool r = operand1 == operand2;
10606 PyObject *result = BOOL_FROM(r);
10607 Py_INCREF_IMMORTAL(result);
10611 bool r = operand1 != operand2;
10612 PyObject *result = BOOL_FROM(r);
10613 Py_INCREF_IMMORTAL(result);
10617#if PYTHON_VERSION < 0x360
10618 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != list()", type1->tp_name);
10620 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'list'", type1->tp_name);
10628PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *operand2) {
10630 if (&PyList_Type == Py_TYPE(operand2)) {
10631 return COMPARE_NE_OBJECT_LIST_LIST(operand1, operand2);
10634#if PYTHON_VERSION < 0x300
10635 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
10639 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
10644 PyTypeObject *type2 = Py_TYPE(operand2);
10646#if PYTHON_VERSION < 0x300
10648 if (&PyList_Type == type2 && !0) {
10650 richcmpfunc frich = PyList_Type.tp_richcompare;
10652 if (frich != NULL) {
10653 PyObject *result = (*frich)(operand1, operand2, Py_NE);
10655 if (result != Py_NotImplemented) {
10656 Py_LeaveRecursiveCall();
10661 Py_DECREF_IMMORTAL(result);
10665 cmpfunc fcmp = NULL;
10667 if (fcmp != NULL) {
10668 int c = (*fcmp)(operand1, operand2);
10669 c = adjust_tp_compare(c);
10671 Py_LeaveRecursiveCall();
10697 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
10701 PyObject *result = BOOL_FROM(r);
10702 Py_INCREF_IMMORTAL(result);
10710 if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10711 f = TP_RICHCOMPARE(type2);
10714 PyObject *result = (*f)(operand2, operand1, Py_NE);
10716 if (result != Py_NotImplemented) {
10717 Py_LeaveRecursiveCall();
10722 Py_DECREF_IMMORTAL(result);
10726 f = PyList_Type.tp_richcompare;
10728 PyObject *result = (*f)(operand1, operand2, Py_NE);
10730 if (result != Py_NotImplemented) {
10731 Py_LeaveRecursiveCall();
10736 Py_DECREF_IMMORTAL(result);
10739 f = TP_RICHCOMPARE(type2);
10741 PyObject *result = (*f)(operand2, operand1, Py_NE);
10743 if (result != Py_NotImplemented) {
10744 Py_LeaveRecursiveCall();
10749 Py_DECREF_IMMORTAL(result);
10755 cmpfunc fcmp = NULL;
10756 c = (*fcmp)(operand1, operand2);
10757 }
else if (PyInstance_Check(operand2)) {
10758 cmpfunc fcmp = type2->tp_compare;
10759 c = (*fcmp)(operand1, operand2);
10761 c = try_3way_compare(operand1, operand2);
10765 if (&PyList_Type == type2) {
10766 Py_uintptr_t aa = (Py_uintptr_t)operand1;
10767 Py_uintptr_t bb = (Py_uintptr_t)operand2;
10769 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10770 }
else if (operand1 == Py_None) {
10773 }
else if (operand2 == Py_None) {
10776 }
else if (PyNumber_Check(operand1)) {
10779 if (PyNumber_Check(operand2)) {
10781 Py_uintptr_t aa = (Py_uintptr_t)&PyList_Type;
10782 Py_uintptr_t bb = (Py_uintptr_t)type2;
10784 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10788 }
else if (PyNumber_Check(operand2)) {
10792 int s = strcmp(
"list", type2->tp_name);
10796 }
else if (s > 0) {
10800 Py_uintptr_t aa = (Py_uintptr_t)&PyList_Type;
10801 Py_uintptr_t bb = (Py_uintptr_t)type2;
10803 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
10808 Py_LeaveRecursiveCall();
10810 if (unlikely(c <= -2)) {
10836 PyObject *result = BOOL_FROM(r);
10837 Py_INCREF_IMMORTAL(result);
10840 bool checked_reverse_op =
false;
10843 if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10844 f = TP_RICHCOMPARE(type2);
10847 checked_reverse_op =
true;
10849 PyObject *result = (*f)(operand2, operand1, Py_NE);
10851 if (result != Py_NotImplemented) {
10852 Py_LeaveRecursiveCall();
10857 Py_DECREF_IMMORTAL(result);
10861 f = PyList_Type.tp_richcompare;
10864 PyObject *result = (*f)(operand1, operand2, Py_NE);
10866 if (result != Py_NotImplemented) {
10867 Py_LeaveRecursiveCall();
10872 Py_DECREF_IMMORTAL(result);
10875 if (checked_reverse_op ==
false) {
10876 f = TP_RICHCOMPARE(type2);
10879 PyObject *result = (*f)(operand2, operand1, Py_NE);
10881 if (result != Py_NotImplemented) {
10882 Py_LeaveRecursiveCall();
10887 Py_DECREF_IMMORTAL(result);
10891 Py_LeaveRecursiveCall();
10897 bool r = operand1 == operand2;
10898 PyObject *result = BOOL_FROM(r);
10899 Py_INCREF_IMMORTAL(result);
10903 bool r = operand1 != operand2;
10904 PyObject *result = BOOL_FROM(r);
10905 Py_INCREF_IMMORTAL(result);
10909#if PYTHON_VERSION < 0x360
10910 PyErr_Format(PyExc_TypeError,
"unorderable types: list() != %s()", type2->tp_name);
10912 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'list' and '%s'", type2->tp_name);
10920PyObject *RICH_COMPARE_NE_OBJECT_LIST_LIST(PyObject *operand1, PyObject *operand2) {
10922 return COMPARE_NE_OBJECT_LIST_LIST(operand1, operand2);
10925static nuitka_bool COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *operand2) {
10926 CHECK_OBJECT(operand1);
10927 assert(PyList_CheckExact(operand1));
10928 CHECK_OBJECT(operand2);
10929 assert(PyList_CheckExact(operand2));
10931 PyListObject *a = (PyListObject *)operand1;
10932 PyListObject *b = (PyListObject *)operand2;
10934 if (Py_SIZE(a) != Py_SIZE(b)) {
10938 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10943 nuitka_bool res = NUITKA_BOOL_TRUE;
10946 for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
10947 PyObject *aa = a->ob_item[i];
10948 PyObject *bb = b->ob_item[i];
10956 res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
10960 if (res == NUITKA_BOOL_EXCEPTION) {
10961 return NUITKA_BOOL_EXCEPTION;
10964 if (res == NUITKA_BOOL_FALSE) {
10971 if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
10972 r = Py_SIZE(a) != Py_SIZE(b);
10974 r = res == NUITKA_BOOL_FALSE;
10978 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
10983nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *operand2) {
10985 if (Py_TYPE(operand1) == &PyList_Type) {
10986 return COMPARE_NE_NBOOL_LIST_LIST(operand1, operand2);
10989#if PYTHON_VERSION < 0x300
10990 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
10991 return NUITKA_BOOL_EXCEPTION;
10994 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
10995 return NUITKA_BOOL_EXCEPTION;
10999 PyTypeObject *type1 = Py_TYPE(operand1);
11001#if PYTHON_VERSION < 0x300
11003 if (type1 == &PyList_Type && !0) {
11005 richcmpfunc frich = PyList_Type.tp_richcompare;
11007 if (frich != NULL) {
11008 PyObject *result = (*frich)(operand1, operand2, Py_NE);
11010 if (result != Py_NotImplemented) {
11011 Py_LeaveRecursiveCall();
11013 if (unlikely(result == NULL)) {
11014 return NUITKA_BOOL_EXCEPTION;
11018 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11024 Py_DECREF_IMMORTAL(result);
11028 cmpfunc fcmp = NULL;
11030 if (fcmp != NULL) {
11031 int c = (*fcmp)(operand1, operand2);
11032 c = adjust_tp_compare(c);
11034 Py_LeaveRecursiveCall();
11037 return NUITKA_BOOL_EXCEPTION;
11060 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
11064 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11073 if (type1 != &PyList_Type && 0) {
11074 f = PyList_Type.tp_richcompare;
11077 PyObject *result = (*f)(operand2, operand1, Py_NE);
11079 if (result != Py_NotImplemented) {
11080 Py_LeaveRecursiveCall();
11082 if (unlikely(result == NULL)) {
11083 return NUITKA_BOOL_EXCEPTION;
11087 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11093 Py_DECREF_IMMORTAL(result);
11097 f = TP_RICHCOMPARE(type1);
11099 PyObject *result = (*f)(operand1, operand2, Py_NE);
11101 if (result != Py_NotImplemented) {
11102 Py_LeaveRecursiveCall();
11104 if (unlikely(result == NULL)) {
11105 return NUITKA_BOOL_EXCEPTION;
11109 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11115 Py_DECREF_IMMORTAL(result);
11118 f = PyList_Type.tp_richcompare;
11120 PyObject *result = (*f)(operand2, operand1, Py_NE);
11122 if (result != Py_NotImplemented) {
11123 Py_LeaveRecursiveCall();
11125 if (unlikely(result == NULL)) {
11126 return NUITKA_BOOL_EXCEPTION;
11130 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11136 Py_DECREF_IMMORTAL(result);
11141 if (PyInstance_Check(operand1)) {
11142 cmpfunc fcmp = type1->tp_compare;
11143 c = (*fcmp)(operand1, operand2);
11145 cmpfunc fcmp = NULL;
11146 c = (*fcmp)(operand1, operand2);
11148 c = try_3way_compare(operand1, operand2);
11152 if (type1 == &PyList_Type) {
11153 Py_uintptr_t aa = (Py_uintptr_t)operand1;
11154 Py_uintptr_t bb = (Py_uintptr_t)operand2;
11156 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11157 }
else if (operand1 == Py_None) {
11160 }
else if (operand2 == Py_None) {
11163 }
else if (PyNumber_Check(operand1)) {
11166 if (PyNumber_Check(operand2)) {
11168 Py_uintptr_t aa = (Py_uintptr_t)type1;
11169 Py_uintptr_t bb = (Py_uintptr_t)&PyList_Type;
11171 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11175 }
else if (PyNumber_Check(operand2)) {
11179 int s = strcmp(type1->tp_name,
"list");
11183 }
else if (s > 0) {
11187 Py_uintptr_t aa = (Py_uintptr_t)type1;
11188 Py_uintptr_t bb = (Py_uintptr_t)&PyList_Type;
11190 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11195 Py_LeaveRecursiveCall();
11197 if (unlikely(c <= -2)) {
11198 return NUITKA_BOOL_EXCEPTION;
11223 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11227 bool checked_reverse_op =
false;
11230 if (type1 != &PyList_Type && Nuitka_Type_IsSubtype(&PyList_Type, type1)) {
11231 f = PyList_Type.tp_richcompare;
11234 checked_reverse_op =
true;
11236 PyObject *result = (*f)(operand2, operand1, Py_NE);
11238 if (result != Py_NotImplemented) {
11239 Py_LeaveRecursiveCall();
11241 if (unlikely(result == NULL)) {
11242 return NUITKA_BOOL_EXCEPTION;
11246 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11252 Py_DECREF_IMMORTAL(result);
11256 f = TP_RICHCOMPARE(type1);
11259 PyObject *result = (*f)(operand1, operand2, Py_NE);
11261 if (result != Py_NotImplemented) {
11262 Py_LeaveRecursiveCall();
11264 if (unlikely(result == NULL)) {
11265 return NUITKA_BOOL_EXCEPTION;
11269 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11275 Py_DECREF_IMMORTAL(result);
11278 if (checked_reverse_op ==
false) {
11279 f = PyList_Type.tp_richcompare;
11282 PyObject *result = (*f)(operand2, operand1, Py_NE);
11284 if (result != Py_NotImplemented) {
11285 Py_LeaveRecursiveCall();
11287 if (unlikely(result == NULL)) {
11288 return NUITKA_BOOL_EXCEPTION;
11292 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11298 Py_DECREF_IMMORTAL(result);
11302 Py_LeaveRecursiveCall();
11308 bool r = operand1 == operand2;
11309 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11314 bool r = operand1 != operand2;
11315 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11320#if PYTHON_VERSION < 0x360
11321 PyErr_Format(PyExc_TypeError,
"unorderable types: %s() != list()", type1->tp_name);
11323 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of '%s' and 'list'", type1->tp_name);
11325 return NUITKA_BOOL_EXCEPTION;
11331nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *operand2) {
11333 if (&PyList_Type == Py_TYPE(operand2)) {
11334 return COMPARE_NE_NBOOL_LIST_LIST(operand1, operand2);
11337#if PYTHON_VERSION < 0x300
11338 if (unlikely(Py_EnterRecursiveCall((
char *)
" in cmp"))) {
11339 return NUITKA_BOOL_EXCEPTION;
11342 if (unlikely(Py_EnterRecursiveCall((
char *)
" in comparison"))) {
11343 return NUITKA_BOOL_EXCEPTION;
11347 PyTypeObject *type2 = Py_TYPE(operand2);
11349#if PYTHON_VERSION < 0x300
11351 if (&PyList_Type == type2 && !0) {
11353 richcmpfunc frich = PyList_Type.tp_richcompare;
11355 if (frich != NULL) {
11356 PyObject *result = (*frich)(operand1, operand2, Py_NE);
11358 if (result != Py_NotImplemented) {
11359 Py_LeaveRecursiveCall();
11361 if (unlikely(result == NULL)) {
11362 return NUITKA_BOOL_EXCEPTION;
11366 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11372 Py_DECREF_IMMORTAL(result);
11376 cmpfunc fcmp = NULL;
11378 if (fcmp != NULL) {
11379 int c = (*fcmp)(operand1, operand2);
11380 c = adjust_tp_compare(c);
11382 Py_LeaveRecursiveCall();
11385 return NUITKA_BOOL_EXCEPTION;
11408 NUITKA_CANNOT_GET_HERE(
"wrong op_code");
11412 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11421 if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11422 f = TP_RICHCOMPARE(type2);
11425 PyObject *result = (*f)(operand2, operand1, Py_NE);
11427 if (result != Py_NotImplemented) {
11428 Py_LeaveRecursiveCall();
11430 if (unlikely(result == NULL)) {
11431 return NUITKA_BOOL_EXCEPTION;
11435 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11441 Py_DECREF_IMMORTAL(result);
11445 f = PyList_Type.tp_richcompare;
11447 PyObject *result = (*f)(operand1, operand2, Py_NE);
11449 if (result != Py_NotImplemented) {
11450 Py_LeaveRecursiveCall();
11452 if (unlikely(result == NULL)) {
11453 return NUITKA_BOOL_EXCEPTION;
11457 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11463 Py_DECREF_IMMORTAL(result);
11466 f = TP_RICHCOMPARE(type2);
11468 PyObject *result = (*f)(operand2, operand1, Py_NE);
11470 if (result != Py_NotImplemented) {
11471 Py_LeaveRecursiveCall();
11473 if (unlikely(result == NULL)) {
11474 return NUITKA_BOOL_EXCEPTION;
11478 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11484 Py_DECREF_IMMORTAL(result);
11490 cmpfunc fcmp = NULL;
11491 c = (*fcmp)(operand1, operand2);
11492 }
else if (PyInstance_Check(operand2)) {
11493 cmpfunc fcmp = type2->tp_compare;
11494 c = (*fcmp)(operand1, operand2);
11496 c = try_3way_compare(operand1, operand2);
11500 if (&PyList_Type == type2) {
11501 Py_uintptr_t aa = (Py_uintptr_t)operand1;
11502 Py_uintptr_t bb = (Py_uintptr_t)operand2;
11504 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11505 }
else if (operand1 == Py_None) {
11508 }
else if (operand2 == Py_None) {
11511 }
else if (PyNumber_Check(operand1)) {
11514 if (PyNumber_Check(operand2)) {
11516 Py_uintptr_t aa = (Py_uintptr_t)&PyList_Type;
11517 Py_uintptr_t bb = (Py_uintptr_t)type2;
11519 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11523 }
else if (PyNumber_Check(operand2)) {
11527 int s = strcmp(
"list", type2->tp_name);
11531 }
else if (s > 0) {
11535 Py_uintptr_t aa = (Py_uintptr_t)&PyList_Type;
11536 Py_uintptr_t bb = (Py_uintptr_t)type2;
11538 c = (aa < bb) ? -1 : (aa > bb) ? 1 : 0;
11543 Py_LeaveRecursiveCall();
11545 if (unlikely(c <= -2)) {
11546 return NUITKA_BOOL_EXCEPTION;
11571 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11575 bool checked_reverse_op =
false;
11578 if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11579 f = TP_RICHCOMPARE(type2);
11582 checked_reverse_op =
true;
11584 PyObject *result = (*f)(operand2, operand1, Py_NE);
11586 if (result != Py_NotImplemented) {
11587 Py_LeaveRecursiveCall();
11589 if (unlikely(result == NULL)) {
11590 return NUITKA_BOOL_EXCEPTION;
11594 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11600 Py_DECREF_IMMORTAL(result);
11604 f = PyList_Type.tp_richcompare;
11607 PyObject *result = (*f)(operand1, operand2, Py_NE);
11609 if (result != Py_NotImplemented) {
11610 Py_LeaveRecursiveCall();
11612 if (unlikely(result == NULL)) {
11613 return NUITKA_BOOL_EXCEPTION;
11617 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11623 Py_DECREF_IMMORTAL(result);
11626 if (checked_reverse_op ==
false) {
11627 f = TP_RICHCOMPARE(type2);
11630 PyObject *result = (*f)(operand2, operand1, Py_NE);
11632 if (result != Py_NotImplemented) {
11633 Py_LeaveRecursiveCall();
11635 if (unlikely(result == NULL)) {
11636 return NUITKA_BOOL_EXCEPTION;
11640 nuitka_bool r = CHECK_IF_TRUE(result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11646 Py_DECREF_IMMORTAL(result);
11650 Py_LeaveRecursiveCall();
11656 bool r = operand1 == operand2;
11657 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11662 bool r = operand1 != operand2;
11663 nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
11668#if PYTHON_VERSION < 0x360
11669 PyErr_Format(PyExc_TypeError,
"unorderable types: list() != %s()", type2->tp_name);
11671 PyErr_Format(PyExc_TypeError,
"'!=' not supported between instances of 'list' and '%s'", type2->tp_name);
11673 return NUITKA_BOOL_EXCEPTION;
11679nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *operand2) {
11681 return COMPARE_NE_NBOOL_LIST_LIST(operand1, operand2);
11684static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1,
long operand2) {
11685 CHECK_OBJECT(operand1);
11686 assert(PyLong_CheckExact(operand1));
11688 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
11690 bool operand2_is_negative;
11691 unsigned long operand2_abs_ival;
11693 if (operand2 < 0) {
11694 operand2_abs_ival = (
unsigned long)(-1 - operand2) + 1;
11695 operand2_is_negative =
true;
11697 operand2_abs_ival = (
unsigned long)operand2;
11698 operand2_is_negative =
false;
11701 Py_ssize_t operand2_digit_count = 0;
11702 digit operand2_digits[5] = {0};
11704 unsigned long t = operand2_abs_ival;
11707 operand2_digit_count += 1;
11708 assert(operand2_digit_count <= (Py_ssize_t)(
sizeof(operand2_digit_count) /
sizeof(digit)));
11710 operand2_digits[operand2_digit_count] = (digit)(t & PyLong_MASK);
11711 t >>= PyLong_SHIFT;
11715 NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
11716 operand2_is_negative ==
false ? operand2_digit_count : -operand2_digit_count;
11720 if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11723 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11726 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11734 PyObject *result = BOOL_FROM(r);
11735 Py_INCREF_IMMORTAL(result);
11738#if PYTHON_VERSION < 0x300
11740PyObject *RICH_COMPARE_NE_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
11742 return COMPARE_NE_OBJECT_LONG_CLONG(operand1, PyInt_AS_LONG(operand1));
11746static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1,
long operand2) {
11747 CHECK_OBJECT(operand1);
11748 assert(PyLong_CheckExact(operand1));
11750 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
11752 bool operand2_is_negative;
11753 unsigned long operand2_abs_ival;
11755 if (operand2 < 0) {
11756 operand2_abs_ival = (
unsigned long)(-1 - operand2) + 1;
11757 operand2_is_negative =
true;
11759 operand2_abs_ival = (
unsigned long)operand2;
11760 operand2_is_negative =
false;
11763 Py_ssize_t operand2_digit_count = 0;
11764 digit operand2_digits[5] = {0};
11766 unsigned long t = operand2_abs_ival;
11769 operand2_digit_count += 1;
11770 assert(operand2_digit_count <= (Py_ssize_t)(
sizeof(operand2_digit_count) /
sizeof(digit)));
11772 operand2_digits[operand2_digit_count] = (digit)(t & PyLong_MASK);
11773 t >>= PyLong_SHIFT;
11777 NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
11778 operand2_is_negative ==
false ? operand2_digit_count : -operand2_digit_count;
11782 if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11785 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11788 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11800#if PYTHON_VERSION < 0x300
11802bool RICH_COMPARE_NE_CBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
11804 return COMPARE_NE_CBOOL_LONG_CLONG(operand1, PyInt_AS_LONG(operand1));
11808#if PYTHON_VERSION < 0x300
11809static PyObject *COMPARE_NE_OBJECT_INT_CLONG(PyObject *operand1,
long operand2) {
11810 CHECK_OBJECT(operand1);
11811 assert(PyInt_CheckExact(operand1));
11813 const long a = PyInt_AS_LONG(operand1);
11814 const long b = operand2;
11819 PyObject *result = BOOL_FROM(r);
11820 Py_INCREF_IMMORTAL(result);
11824#if PYTHON_VERSION < 0x300
11826PyObject *RICH_COMPARE_NE_OBJECT_INT_CLONG(PyObject *operand1,
long operand2) {
11828 return COMPARE_NE_OBJECT_INT_CLONG(operand1, operand2);
11832#if PYTHON_VERSION < 0x300
11833static bool COMPARE_NE_CBOOL_INT_CLONG(PyObject *operand1,
long operand2) {
11834 CHECK_OBJECT(operand1);
11835 assert(PyInt_CheckExact(operand1));
11837 const long a = PyInt_AS_LONG(operand1);
11838 const long b = operand2;
11848#if PYTHON_VERSION < 0x300
11850bool RICH_COMPARE_NE_CBOOL_INT_CLONG(PyObject *operand1,
long operand2) {
11852 return COMPARE_NE_CBOOL_INT_CLONG(operand1, operand2);
11856static PyObject *COMPARE_NE_OBJECT_LONG_DIGIT(PyObject *operand1,
long operand2) {
11857 CHECK_OBJECT(operand1);
11858 assert(PyLong_CheckExact(operand1));
11859 assert(Py_ABS(operand2) < (1 << PyLong_SHIFT));
11861 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
11865 if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11866 (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11869 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11872 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11880 PyObject *result = BOOL_FROM(r);
11881 Py_INCREF_IMMORTAL(result);
11886PyObject *RICH_COMPARE_NE_OBJECT_LONG_DIGIT(PyObject *operand1,
long operand2) {
11888 return COMPARE_NE_OBJECT_LONG_DIGIT(operand1, operand2);
11891static bool COMPARE_NE_CBOOL_LONG_DIGIT(PyObject *operand1,
long operand2) {
11892 CHECK_OBJECT(operand1);
11893 assert(PyLong_CheckExact(operand1));
11894 assert(Py_ABS(operand2) < (1 << PyLong_SHIFT));
11896 PyLongObject *operand1_long_object = (PyLongObject *)operand1;
11900 if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11901 (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11904 Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11907 if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11921bool RICH_COMPARE_NE_CBOOL_LONG_DIGIT(PyObject *operand1,
long operand2) {
11923 return COMPARE_NE_CBOOL_LONG_DIGIT(operand1, operand2);
11926static PyObject *COMPARE_NE_OBJECT_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
11927 CHECK_OBJECT(operand1);
11928 assert(PyFloat_CheckExact(operand1));
11930 const double a = PyFloat_AS_DOUBLE(operand1);
11931 const double b = operand2;
11936 PyObject *result = BOOL_FROM(r);
11937 Py_INCREF_IMMORTAL(result);
11941PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
11943 return COMPARE_NE_OBJECT_FLOAT_CFLOAT(operand1, operand2);
11946static bool COMPARE_NE_CBOOL_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
11947 CHECK_OBJECT(operand1);
11948 assert(PyFloat_CheckExact(operand1));
11950 const double a = PyFloat_AS_DOUBLE(operand1);
11951 const double b = operand2;
11961bool RICH_COMPARE_NE_CBOOL_FLOAT_CFLOAT(PyObject *operand1,
double operand2) {
11963 return COMPARE_NE_CBOOL_FLOAT_CFLOAT(operand1, operand2);