Commit f3283c17 authored by Tim Peters's avatar Tim Peters

type_and_adr(): Display the oid too.

parent bc634ac2
...@@ -76,6 +76,12 @@ Install ...@@ -76,6 +76,12 @@ Install
The C header file ``ring.h`` is now installed. The C header file ``ring.h`` is now installed.
Tools
-----
- ``BTrees.check.display()`` now displays the oids (if any) of the
BTree's or TreeSet's constituent objects.
What's new in ZODB3 3.3? What's new in ZODB3 3.3?
======================== ========================
......
...@@ -39,7 +39,7 @@ from BTrees.OIBTree import OIBTree, OIBucket, OISet, OITreeSet ...@@ -39,7 +39,7 @@ from BTrees.OIBTree import OIBTree, OIBucket, OISet, OITreeSet
from BTrees.IOBTree import IOBTree, IOBucket, IOSet, IOTreeSet from BTrees.IOBTree import IOBTree, IOBucket, IOSet, IOTreeSet
from BTrees.IIBTree import IIBTree, IIBucket, IISet, IITreeSet from BTrees.IIBTree import IIBTree, IIBucket, IISet, IITreeSet
from ZODB.utils import positive_id from ZODB.utils import positive_id, oid_repr
TYPE_UNKNOWN, TYPE_BTREE, TYPE_BUCKET = range(3) TYPE_UNKNOWN, TYPE_BTREE, TYPE_BUCKET = range(3)
...@@ -200,7 +200,11 @@ def crack_bucket(b, is_mapping): ...@@ -200,7 +200,11 @@ def crack_bucket(b, is_mapping):
return keys, values return keys, values
def type_and_adr(obj): def type_and_adr(obj):
return "%s (0x%x)" % (type(obj).__name__, positive_id(obj)) if hasattr(obj, '_p_oid'):
oid = oid_repr(obj._p_oid)
else:
oid = 'None'
return "%s (0x%x oid=%s)" % (type(obj).__name__, positive_id(obj), oid)
# Walker implements a depth-first search of a BTree (or TreeSet or Set or # Walker implements a depth-first search of a BTree (or TreeSet or Set or
# Bucket). Subclasses must implement the visit_btree() and visit_bucket() # Bucket). Subclasses must implement the visit_btree() and visit_bucket()
......
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