Commit 50b699df authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ee5f34ae
......@@ -229,7 +229,7 @@ def Restructure(ztree, newStructure):
# we will modify nodes from new set:
# - node.Z will point to associated znode
# - bucket.next_bucket will point to bucket that is coming next in the tree
# - bucket.next_bucket will point to bucket that is coming with next keys in the tree
tnew = newStructure.copy()
zrlevelv = list(__zwalkBFS(ztree)) # [] of _NodeInRange
......@@ -246,6 +246,10 @@ def Restructure(ztree, newStructure):
zrlevel = zrlevelv.pop(0)
# XXX filter-out buckets
_ = []
for zrn in zrlevel:
assert isinstance(zrn.node, (ztreeType, zbucketType))
if isinstance(zrn.node, z
if len(zrlevel) == len(rlevel): # map 1-1
for (zrn, rn) in zip(zrlevel, rlevel):
......@@ -283,7 +287,7 @@ def Restructure(ztree, newStructure):
# https://github.com/zopefoundation/BTrees/blob/4.5.0-1-gc8bf24e/BTrees/BucketTemplate.c#L1195
zstate = ()
for k in node.keyv:
zstate += (k, kv[k]) # (k1, v1, k2, v2, ..., kN, vN)
zstate += (k, kv.pop(k)) # (k1, v1, k2, v2, ..., kN, vN)
zstate = (zstate,)
if node.next_bucket is not None: # next
......@@ -309,6 +313,7 @@ def Restructure(ztree, newStructure):
assert tnew.Z is ztree
assert len(kv) == 0 # all keys must have been popped
_bcheck(ztree) # verify ztree after our tweaks
tstruct = StructureOf(ztree)
......
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