[Zodb-checkins] CVS: Zope3/src/BTrees - check.py:1.6

Tim Peters tim.one at comcast.net
Tue Apr 6 16:22:26 EDT 2004


Update of /cvs-repository/Zope3/src/BTrees
In directory cvs.zope.org:/tmp/cvs-serv30747/src/BTrees

Modified Files:
	check.py 
Log Message:
As part of int/long unification, Python 2.4 will start printing
negative ints *as* negative ints when fed into %x formats.  Python 2.3
still renders them as positive ints, but spews

FutureWarning: %u/%o/%x/%X of negative int will return a signed string
               in Python 2.4 and up

to warn about the impending change.  Jim reported two instances of that
warning when running the tests on a box where addresses happen to "be
negative".  So make the addresses look positive instead (2.3 and 2.4
treat those the same, so 2.3 doesn't warn about those).

Problem:  it occurs to me now that I'm assuming addresses fit in 32
bits here.


=== Zope3/src/BTrees/check.py 1.5 => 1.6 ===
--- Zope3/src/BTrees/check.py:1.5	Thu Oct  2 16:17:53 2003
+++ Zope3/src/BTrees/check.py	Tue Apr  6 16:21:55 2004
@@ -198,7 +198,9 @@
     return keys, values
 
 def type_and_adr(obj):
-    return "%s (0x%x)" % (type(obj).__name__, id(obj))
+    # Force the address to look positive.  A negative address will
+    # show up as signed in Python 2.4, and in 2.3 raises FutureWarning.
+    return "%s (0x%x)" % (type(obj).__name__, id(obj) & 0xffffffffL)
 
 # Walker implements a depth-first search of a BTree (or TreeSet or Set or
 # Bucket).  Subclasses must implement the visit_btree() and visit_bucket()




More information about the Zodb-checkins mailing list