[Zodb-checkins] CVS: Zope3/src/ZODB/tests - testTransaction.py:1.24

Tim Peters tim.one at comcast.net
Tue Apr 6 17:47:14 EDT 2004

Update of /cvs-repository/Zope3/src/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv14114/src/ZODB/tests

Modified Files:
Log Message:
ZODB.utils grows a new function positive_id(), which returns the id() of
an object as a non-negative integer.  Code trying to pass addresses to
an %x format uses positive_id(), and this avoids a Python FutureWarning
about applying %x to negative ints.  The primary difference between this
and the last stab is that positive_id() should work OK on 64-bit boxes
too.  What we really want here is C's %p format code, but in Python we
can't even reliably know the width of native addresses.

=== Zope3/src/ZODB/tests/testTransaction.py 1.23 => 1.24 ===
--- Zope3/src/ZODB/tests/testTransaction.py:1.23	Mon Apr  5 21:06:41 2004
+++ Zope3/src/ZODB/tests/testTransaction.py	Tue Apr  6 17:47:12 2004
@@ -41,6 +41,7 @@
 import unittest
 import transaction
+from ZODB.utils import positive_id
 class TransactionTests(unittest.TestCase):
@@ -532,7 +533,9 @@
         self.ccommit_sub = 0
     def __repr__(self):
-        return "<%s %X %s>" % (self.__class__.__name__, id(self), self.errors)
+        return "<%s %X %s>" % (self.__class__.__name__,
+                               positive_id(self),
+                               self.errors)
     def sortKey(self):
         # All these jars use the same sort key, and Python's list.sort()

More information about the Zodb-checkins mailing list