diff Objects/bufferobject.c @ 39395:997788de8667 legacy-trunk

memcmp() can return values other than -1, 0, and +1 but tp_compare must not.
author Thomas Heller <theller@ctypes.org>
date Tue, 08 Aug 2006 17:37:00 +0000
parents 0b3fe2b734a1
children 1bbcd392417d
line wrap: on
line diff
--- a/Objects/bufferobject.c	Tue Aug 08 11:56:21 2006 +0000
+++ b/Objects/bufferobject.c	Tue Aug 08 17:37:00 2006 +0000
@@ -272,7 +272,7 @@
 	if (min_len > 0) {
 		cmp = memcmp(p1, p2, min_len);
 		if (cmp != 0)
-			return cmp;
+			return cmp < 0 ? -1 : 1;
 	}
 	return (len_self < len_other) ? -1 : (len_self > len_other) ? 1 : 0;
 }