Fix pttree
authorAntonio Valentino <antonio.valentino@tiscali.it>
Sat, 21 Dec 2019 16:52:35 +0000 (16:52 +0000)
committerAntonio Valentino <antonio.valentino@tiscali.it>
Tue, 8 Dec 2020 09:02:17 +0000 (09:02 +0000)
Fix the mamagement of UnImplemented objects in the pttree tool.
Patch backorted from upstream:
https://github.com/PyTables/PyTables/commit/5280b856189a05ceee8f034d8781d052fb5dbe5a
Closes: #941954.
Gbp-Pq: Name 0006-Fix-pttree.patch

tables/scripts/pttree.py

index 1ba7045c0d459019addf1f1cb9ed1e3dfc99024c..8101a6bf78810604e28310ff9d30dd23f1628409 100644 (file)
@@ -175,7 +175,10 @@ def get_tree_str(f, where='/', max_depth=-1, print_class=True,
         ref_idx[path] = ref_count[addr]
         hl_addresses[path] = addr
 
-        if isinstance(node, tables.Leaf):
+        if isinstance(node, tables.UnImplemented):
+            leaves.append(node)
+
+        elif isinstance(node, tables.Leaf):
 
             # only count the size of a hardlinked leaf the first time it is
             # visited
@@ -201,7 +204,7 @@ def get_tree_str(f, where='/', max_depth=-1, print_class=True,
 
                 except NotImplementedError as e:
                     # size_on_disk is not implemented for VLArrays
-                    warnings.warn(e.message)
+                    warnings.warn(str(e))
 
             # push leaf nodes onto the stack for the next pass
             leaves.append(node)