[Python-checkins] CVS: python/dist/src/Objects object.c,2.95,2.96

Barry Warsaw python-dev@python.org
Thu, 17 Aug 2000 22:01:22 -0700


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

Modified Files:
	object.c 
Log Message:
make_pair(): 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: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.95
retrieving revision 2.96
diff -C2 -r2.95 -r2.96
*** object.c	2000/08/16 12:24:51	2.95
--- object.c	2000/08/18 05:01:19	2.96
***************
*** 372,375 ****
--- 372,377 ----
  {
  	PyObject *pair;
+ 	Py_uintptr_t iv = (Py_uintptr_t)v;
+ 	Py_uintptr_t iw = (Py_uintptr_t)w;
  
  	pair = PyTuple_New(2);
***************
*** 377,381 ****
  		return NULL;
  	}
! 	if (v <= w) {
  		PyTuple_SET_ITEM(pair, 0, PyLong_FromVoidPtr((void *)v));
  		PyTuple_SET_ITEM(pair, 1, PyLong_FromVoidPtr((void *)w));
--- 379,383 ----
  		return NULL;
  	}
! 	if (iv <= iw) {
  		PyTuple_SET_ITEM(pair, 0, PyLong_FromVoidPtr((void *)v));
  		PyTuple_SET_ITEM(pair, 1, PyLong_FromVoidPtr((void *)w));
***************
*** 488,492 ****
  	}
  	if (vtp->tp_compare == NULL) {
! 		return (v < w) ? -1 : 1;
  	}
  	_PyCompareState_nesting++;
--- 490,496 ----
  	}
  	if (vtp->tp_compare == NULL) {
! 		Py_uintptr_t iv = (Py_uintptr_t)v;
! 		Py_uintptr_t iw = (Py_uintptr_t)w;
! 		return (iv < iw) ? -1 : 1;
  	}
  	_PyCompareState_nesting++;