[Python-checkins] CVS: python/dist/src/Objects classobject.c,2.103,2.104

Barry Warsaw python-dev@python.org
Thu, 17 Aug 2000 21:57:34 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory slayer.i.sourceforge.net:/tmp/cvs-serv26660

Modified Files:
	classobject.c 
Log Message:
PyInstance_DoBinOp(): When comparing the pointers, they must be cast
to integer types (i.e. Py_uintptr_t, our spelling of C9X's uintptr_t).
ANSI specifies that pointer compares other than == and != to
non-related structures are undefined.  This quiets an Insure
portability warning.


Index: classobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v
retrieving revision 2.103
retrieving revision 2.104
diff -C2 -r2.103 -r2.104
*** classobject.c	2000/08/17 22:37:32	2.103
--- classobject.c	2000/08/18 04:57:32	2.104
***************
*** 1208,1211 ****
--- 1208,1212 ----
  	char buf[256];
  	PyObject *result = NULL;
+ 
  	if (halfbinop(v, w, opname, &result, thisfunc, 0) <= 0)
  		return result;
***************
*** 1214,1218 ****
  	/* Sigh -- special case for comparisons */
  	if (strcmp(opname, "__cmp__") == 0) {
! 		long c = (v < w) ? -1 : (v > w) ? 1 : 0;
  		return PyInt_FromLong(c);
  	}
--- 1215,1221 ----
  	/* Sigh -- special case for comparisons */
  	if (strcmp(opname, "__cmp__") == 0) {
! 		Py_uintptr_t iv = (Py_uintptr_t)v;
! 		Py_uintptr_t iw = (Py_uintptr_t)w;
! 		long c = (iv < iw) ? -1 : (iv > iw) ? 1 : 0;
  		return PyInt_FromLong(c);
  	}