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

Skip to content

Commit 2da0ea8

Browse files
committed
In try_3way_to_rich_compare(), swap the call to default_3way_compare()
and the test for errors, so that an error in the default compare doesn't go undetected. This fixes SF Bug #132933 (submitted by effbot) -- list.sort doesn't detect comparision errors.
1 parent 230d17d commit 2da0ea8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Objects/object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,10 +777,10 @@ try_3way_to_rich_compare(PyObject *v, PyObject *w, int op)
777777
PyObject *result;
778778

779779
c = try_3way_compare(v, w);
780-
if (c <= -2)
781-
return NULL;
782780
if (c >= 2)
783781
c = default_3way_compare(v, w);
782+
if (c <= -2)
783+
return NULL;
784784
switch (op) {
785785
case Py_LT: c = c < 0; break;
786786
case Py_LE: c = c <= 0; break;

0 commit comments

Comments
 (0)