[Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.133,2.134

Guido van Rossum gvanrossum@users.sourceforge.net
Mon, 24 Sep 2001 09:51:56 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv7513/Objects

Modified Files:
	stringobject.c 
Log Message:
Change string comparison so that it applies even when one (or both)
arguments are subclasses of str, as long as they don't override rich
comparison.


Index: stringobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v
retrieving revision 2.133
retrieving revision 2.134
diff -C2 -d -r2.133 -r2.134
*** stringobject.c	2001/09/12 07:54:51	2.133
--- stringobject.c	2001/09/24 16:51:54	2.134
***************
*** 825,831 ****
  	PyObject *result;
  
! 	/* One of the objects is a string object. Make sure the
! 	   other one is one, too.  */
! 	if (a->ob_type != b->ob_type) {
  		result = Py_NotImplemented;
  		goto out;
--- 825,832 ----
  	PyObject *result;
  
! 	/* May sure both arguments use string comparison.
! 	   This implies PyString_Check(a) && PyString_Check(b). */
! 	if (a->ob_type->tp_richcompare != (richcmpfunc)string_richcompare ||
! 	    b->ob_type->tp_richcompare != (richcmpfunc)string_richcompare) {
  		result = Py_NotImplemented;
  		goto out;