diff Objects/bufferobject.c @ 39397:0bc6cfb6b5fb 2.4

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:42:30 +0000
parents 97c97194e64b
children 0565130d7d9f
line wrap: on
line diff
--- a/Objects/bufferobject.c	Mon Aug 07 00:37:19 2006 +0000
+++ b/Objects/bufferobject.c	Tue Aug 08 17:42:30 2006 +0000
@@ -230,7 +230,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;
 }