diff options
author | Barry Warsaw <barry@python.org> | 2001-01-20 06:24:55 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-01-20 06:24:55 (GMT) |
commit | b0e754d48868bb4f7e3f3a310bbdbe167bc85b80 (patch) | |
tree | 08659e49360a6d0fd73d954acf8a5e79c024e07b | |
parent | 71ff8d5dc5dad320cf71fee03018c5ba4101b683 (diff) | |
download | cpython-b0e754d48868bb4f7e3f3a310bbdbe167bc85b80.zip cpython-b0e754d48868bb4f7e3f3a310bbdbe167bc85b80.tar.gz cpython-b0e754d48868bb4f7e3f3a310bbdbe167bc85b80.tar.bz2 |
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.
-rw-r--r-- | Objects/object.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/object.c b/Objects/object.c index e2a019f..91531e0 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -524,7 +524,11 @@ default_3way_compare(PyObject *v, PyObject *w) int c; if (v->ob_type == w->ob_type) { - /* same type: compare pointers */ + /* When comparing these 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. + */ Py_uintptr_t vv = (Py_uintptr_t)v; Py_uintptr_t ww = (Py_uintptr_t)w; return (vv < ww) ? -1 : (vv > ww) ? 1 : 0; |