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

Tim Peters tim.one at comcast.net
Fri Aug 15 14:24:02 EDT 2003


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

Modified Files:
      Tag: ZODB3-3_1-branch
	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.57.4.1 => 1.57.4.2 ===
--- ZODB3/ExtensionClass/src/ExtensionClass.c:1.57.4.1	Wed Nov 13 11:34:28 2002
+++ ZODB3/ExtensionClass/src/ExtensionClass.c	Fri Aug 15 13:23:56 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