A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-August/008515.html below:

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

[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Objects object.c,2.95,2.96Trent Mick trentm@ActiveState.com
Fri, 18 Aug 2000 10:23:39 -0700
On Thu, Aug 17, 2000 at 10:01:22PM -0700, Barry Warsaw wrote:
> 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++;
> 

Can't you just do the cast for the comparison instead of making new
variables?

Trent

-- 
Trent Mick
TrentM@ActiveState.com



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4