[Python-checkins] CVS: python/dist/src/Objects object.c,2.129,2.130
Tim Peters
tim_one@users.sourceforge.net
Mon, 07 May 2001 13:53:53 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv12135/python/dist/src/objects
Modified Files:
object.c
Log Message:
SF bug #422108 - Error in rich comparisons.
2.1.1 bugfix candidate too.
Fix a bad (albeit unlikely) return value in try_rich_to_3way_compare().
Also document do_cmp()'s return values.
Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.129
retrieving revision 2.130
diff -C2 -r2.129 -r2.130
*** object.c 2001/05/05 10:06:17 2.129
--- object.c 2001/05/07 20:53:51 2.130
***************
*** 448,452 ****
switch (try_rich_compare_bool(v, w, tries[i].op)) {
case -1:
! return -1;
case 1:
return tries[i].outcome;
--- 448,452 ----
switch (try_rich_compare_bool(v, w, tries[i].op)) {
case -1:
! return -2;
case 1:
return tries[i].outcome;
***************
*** 586,589 ****
--- 586,595 ----
#define CHECK_TYPES(o) PyType_HasFeature((o)->ob_type, Py_TPFLAGS_CHECKTYPES)
+ /* Do a 3-way comparison, by hook or by crook. Return:
+ -2 for an exception;
+ -1 if v < w;
+ 0 if v == w;
+ 1 if v > w;
+ */
static int
do_cmp(PyObject *v, PyObject *w)