[Zodb-checkins] CVS: ZODB3/ExtensionClass/src - ExtensionClass.c:1.60

Tim Peters tim.one at comcast.net
Fri Aug 15 14:28:05 EDT 2003


Update of /cvs-repository/ZODB3/ExtensionClass/src
In directory cvs.zope.org:/tmp/cvs-serv15814/ExtensionClass/src

Modified Files:
	ExtensionClass.c 
Log Message:
subclass_compare():  As reported by Neil Schemenauer, instances of
an ExtensionClass type that get into this code can raise RuntimeWarning
under Python 2.3, because the comparison result may be outside the
set {-1, 0, 1}.  Worse, on a box where sizeof(ptrdiff_t) > sizeof(int)
(all 64-bit platforms), comparison results across a set of objects
could be inconsistent because the implicit cast of pointer subtraction
to int loses the information-carrying sign bit.


=== ZODB3/ExtensionClass/src/ExtensionClass.c 1.59 => 1.60 ===
--- ZODB3/ExtensionClass/src/ExtensionClass.c:1.59	Sun Jul 27 22:12:23 2003
+++ ZODB3/ExtensionClass/src/ExtensionClass.c	Fri Aug 15 13:27:58 2003
@@ -2299,7 +2299,7 @@
   UNLESS(m=subclass_getspecial(self,py__cmp__))
     {
       PyErr_Clear();
-      return self-v;
+      return self < v ? -1 : (self != v);
     }
 
   if (UnboundCMethod_Check(m)




More information about the Zodb-checkins mailing list