diff --git a/loopy/kernel/__init__.py b/loopy/kernel/__init__.py index 5dff5e53c04521bcd2f53cb2fc971ec12227149c..3c1aef88165a509a7b3cf169ec73c62e580ea14c 100644 --- a/loopy/kernel/__init__.py +++ b/loopy/kernel/__init__.py @@ -1280,6 +1280,13 @@ class LoopKernel(ImmutableRecordWithoutPickling): return "\n".join(lines) def __str__(self): + if six.PY3: + return self.stringify() + else: + # Path of least resistance... + return self.stringify().encode("utf-8") + + def __unicode__(self): return self.stringify() # }}} diff --git a/loopy/kernel/tools.py b/loopy/kernel/tools.py index 7545070261a9be7a8b5e3e5dde4fdce3e815f44a..e7656db5875e3b9bef648745d9b7a2e5d0798c2a 100644 --- a/loopy/kernel/tools.py +++ b/loopy/kernel/tools.py @@ -1183,7 +1183,7 @@ def draw_dependencies_as_unicode_arrows( def make_extender(): result = n_columns[0] * [" "] for col, (_, updown) in six.iteritems(columns_in_use): - result[col] = do_flag_downward("│", updown) + result[col] = do_flag_downward(u"│", updown) return result @@ -1198,7 +1198,7 @@ def draw_dependencies_as_unicode_arrows( if dep_key not in dep_to_column: col = dep_to_column[dep_key] = find_free_column() columns_in_use[col] = (rdep, "up") - row[col] = "↱" + row[col] = u"↱" for dep in insn.depends_on: assert dep != insn.id @@ -1206,15 +1206,15 @@ def draw_dependencies_as_unicode_arrows( if dep_key not in dep_to_column: col = dep_to_column[dep_key] = find_free_column() columns_in_use[col] = (dep, "down") - row[col] = do_flag_downward("┌", "down") + row[col] = do_flag_downward(u"┌", "down") for col, (end, updown) in list(six.iteritems(columns_in_use)): if insn.id == end: del columns_in_use[col] if updown == "up": - row[col] = "└" + row[col] = u"└" else: - row[col] = do_flag_downward("↳", updown) + row[col] = do_flag_downward(u"↳", updown) extender = make_extender()