[Zodb-checkins] CVS: ZODB3/BTrees - check.py:1.1.2.3

Tim Peters tim.one@comcast.net
Wed, 15 Jan 2003 13:04:15 -0500


Update of /cvs-repository/ZODB3/BTrees
In directory cvs.zope.org:/tmp/cvs-serv11450

Modified Files:
      Tag: ZODB3-3_1-branch
	check.py 
Log Message:
Backporting 2.1 compatibility fixes from Fred Drake.


=== ZODB3/BTrees/check.py 1.1.2.2 => 1.1.2.3 ===
--- ZODB3/BTrees/check.py:1.1.2.2	Tue Jan 14 17:32:49 2003
+++ ZODB3/BTrees/check.py	Wed Jan 15 13:04:12 2003
@@ -32,6 +32,8 @@
 that doesn't exist in the actual BTree).
 """
 
+from types import TupleType
+
 try:
     from zodb.btrees.OOBTree import OOBTree, OOBucket, OOSet, OOTreeSet
     from zodb.btrees.OIBTree import OIBTree, OIBucket, OISet, OITreeSet
@@ -45,6 +47,12 @@
 
 TYPE_UNKNOWN, TYPE_BTREE, TYPE_BUCKET = range(3)
 
+try:
+    True
+except NameError:
+    True = 1
+    False = 0
+
 _type2kind = {IOBTree: (TYPE_BTREE, True),
               IIBTree: (TYPE_BTREE, True),
               OIBTree: (TYPE_BTREE, True),
@@ -131,10 +139,10 @@
     if state is None:
         return BTREE_EMPTY, [], []
 
-    assert isinstance(state, tuple)
+    assert isinstance(state, TupleType)
     if len(state) == 1:
         state = state[0]
-        assert isinstance(state, tuple) and len(state) == 1
+        assert isinstance(state, TupleType) and len(state) == 1
         state = state[0]
         return BTREE_ONE, state, None
 
@@ -183,7 +191,7 @@
 
 def crack_bucket(b, is_mapping):
     state = b.__getstate__()
-    assert isinstance(state, tuple)
+    assert isinstance(state, TupleType)
     assert 1 <= len(state) <= 2
     data = state[0]
     if not is_mapping:
@@ -210,7 +218,7 @@
 # visit_XYZ() methods once for each node in the tree, in depth-first
 # left-to-right order.
 
-class Walker(object):
+class Walker:
     def __init__(self, obj):
         self.obj = obj