mirror of https://github.com/python/cpython
default_3way_compare(): 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.
This commit is contained in:
parent
7f3e4adf60
commit
71ff8d5dc5
|
@ -525,8 +525,8 @@ default_3way_compare(PyObject *v, PyObject *w)
|
|||
|
||||
if (v->ob_type == w->ob_type) {
|
||||
/* same type: compare pointers */
|
||||
void *vv = v;
|
||||
void *ww = w;
|
||||
Py_uintptr_t vv = (Py_uintptr_t)v;
|
||||
Py_uintptr_t ww = (Py_uintptr_t)w;
|
||||
return (vv < ww) ? -1 : (vv > ww) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue