Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9a4e95c

Browse files
committed
The opstrings table was backwards. Add an XXX comment.
1 parent 66a796e commit 9a4e95c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Objects/object.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ PyObject_Compare(PyObject *v, PyObject *w)
619619
/* Map rich comparison operators to their swapped version, e.g. LT <--> GT */
620620
int _Py_SwappedOp[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE};
621621

622-
static char *opstrings[] = {">", ">=", "==", "!=", "<", "<="};
622+
static char *opstrings[] = {"<", "<=", "==", "!=", ">", ">="};
623623

624624
/* Perform a rich comparison, raising TypeError when the requested comparison
625625
operator is not supported. */
@@ -659,6 +659,7 @@ do_richcompare(PyObject *v, PyObject *w, int op)
659659
res = (v != w) ? Py_True : Py_False;
660660
break;
661661
default:
662+
/* XXX Special-case None so it doesn't show as NoneType() */
662663
PyErr_Format(PyExc_TypeError,
663664
"unorderable types: %.100s() %s %.100s()",
664665
v->ob_type->tp_name,

0 commit comments

Comments
 (0)