Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71ff8d5

Browse files
committed
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.
1 parent 7f3e4ad commit 71ff8d5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Objects/object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,8 @@ default_3way_compare(PyObject *v, PyObject *w)
525525

526526
if (v->ob_type == w->ob_type) {
527527
/* same type: compare pointers */
528-
void *vv = v;
529-
void *ww = w;
528+
Py_uintptr_t vv = (Py_uintptr_t)v;
529+
Py_uintptr_t ww = (Py_uintptr_t)w;
530530
return (vv < ww) ? -1 : (vv > ww) ? 1 : 0;
531531
}
532532

0 commit comments

Comments
 (0)