diff --git a/v7/latex/latex/parser.py b/v7/latex/latex/parser.py index 43b9f8fb..a39bab35 100644 --- a/v7/latex/latex/parser.py +++ b/v7/latex/latex/parser.py @@ -338,10 +338,12 @@ def __flatten(self, block): if isinstance(block, tree.Block): while True: if len(block.elements) == 1 and isinstance(block.elements[0], tree.Block): - if isinstance(block, tree.Block): + # Note that the two if conditions below cannot use isinstance() + # since we do not want to match any class derived from Block! + if type(block) is tree.Block: block.elements[0].labels.extend(block.labels) block = block.elements[0] - elif isinstance(block.elements[0], tree.Block): + elif type(block.elements[0]) is tree.Block: block.labels.extend(block.elements[0].labels) block.elements = block.elements[0].elements else: diff --git a/v7/latex/latex/tree.py b/v7/latex/latex/tree.py index 6e75ef4f..aea30714 100644 --- a/v7/latex/latex/tree.py +++ b/v7/latex/latex/tree.py @@ -341,7 +341,7 @@ def recombine_as_text(self, reescape=True): def __str__(self): """Generate textual representation.""" - return "TikzPicture(" + self.args + "; " + repr(self.formula) + ")" + return "TikzPicture(" + str(self.args) + "; " + repr(self.formula) + ")" def visit(self, visitor, *args, **kw): """Process with TreeVisitor object. Passes ``args`` and ``kw`` to the corresponding method of ``visitor``."""