[Python-checkins] CVS: python/dist/src/Objects object.c,2.108,2.109
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 18 Jan 2001 15:33:39 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv26186
Modified Files:
object.c
Log Message:
Rich comparisons fallout: PyObject_Hash() should check for both
tp_compare and tp_richcompare NULL before deciding to do a quickie
based on the object address. (Tim Peters discovered this.)
Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.108
retrieving revision 2.109
diff -C2 -r2.108 -r2.109
*** object.c 2001/01/18 22:07:06 2.108
--- object.c 2001/01/18 23:33:37 2.109
***************
*** 915,919 ****
if (tp->tp_hash != NULL)
return (*tp->tp_hash)(v);
! if (tp->tp_compare == NULL) {
return _Py_HashPointer(v); /* Use address as hash value */
}
--- 915,919 ----
if (tp->tp_hash != NULL)
return (*tp->tp_hash)(v);
! if (tp->tp_compare == NULL && tp->tp_richcompare == NULL) {
return _Py_HashPointer(v); /* Use address as hash value */
}