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

Skip to content

Commit b0e754d

Browse files
committed
Tim chastens:
Barry, that comment belongs in the code, not in the checkin msg. The code *used* to do this correctly (as you well know, since you & I went thru considerable pain to fix this the first time). However, because the *reason* for the convolution wasn't recorded in the code as a comment, somebody threw it all away the first time it got reworked. c-code-isn't-often-self-explanatory-ly y'rs - tim default_3way_compare(): Stick the checkin message from 2.110 in a comment.
1 parent 71ff8d5 commit b0e754d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Objects/object.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,11 @@ default_3way_compare(PyObject *v, PyObject *w)
524524
int c;
525525

526526
if (v->ob_type == w->ob_type) {
527-
/* same type: compare pointers */
527+
/* When comparing these pointers, they must be cast to
528+
* integer types (i.e. Py_uintptr_t, our spelling of C9X's
529+
* uintptr_t). ANSI specifies that pointer compares other
530+
* than == and != to non-related structures are undefined.
531+
*/
528532
Py_uintptr_t vv = (Py_uintptr_t)v;
529533
Py_uintptr_t ww = (Py_uintptr_t)w;
530534
return (vv < ww) ? -1 : (vv > ww) ? 1 : 0;

0 commit comments

Comments
 (0)