Commit 771d5748 authored by Tim Peters's avatar Tim Peters

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.
parent 001c282f
......@@ -198,7 +198,9 @@ def crack_bucket(b, is_mapping):
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()
......
......@@ -13,7 +13,7 @@
##############################################################################
"""Database connection support
$Id: Connection.py,v 1.142 2004/04/02 17:47:57 fdrake Exp $"""
$Id: Connection.py,v 1.143 2004/04/06 20:21:55 tim_one Exp $"""
import logging
import sys
......@@ -223,7 +223,9 @@ class Connection(ExportImport, object):
ver = ' (in version %s)' % `self._version`
else:
ver = ''
return '<Connection at %08x%s>' % (id(self), ver)
# 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 '<Connection at %08x%s>' % (id(self) & 0xffffffffL, ver)
def get(self, oid):
"""Return the persistent object with oid 'oid'.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment