summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-01-20 06:08:10 (GMT)
committerBarry Warsaw <barry@python.org>2001-01-20 06:08:10 (GMT)
commit71ff8d5dc5dad320cf71fee03018c5ba4101b683 (patch)
tree3503cedd6a4ea2879eae6b35c4e088d78fdf5981 /Objects
parent7f3e4adf6057d93e8c372bebec61dda825e4b37e (diff)
downloadcpython-71ff8d5dc5dad320cf71fee03018c5ba4101b683.zip
cpython-71ff8d5dc5dad320cf71fee03018c5ba4101b683.tar.gz
cpython-71ff8d5dc5dad320cf71fee03018c5ba4101b683.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 44344f9..e2a019f 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -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;
}