From f7603dcb6ffb73cdc4633b8f8f5832a2fc1cc442 Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 29 Mar 2016 13:02:14 +0000 Subject: [PATCH] compiler: fix ARTIQ_DUMP_ELF. --- artiq/compiler/targets.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/artiq/compiler/targets.py b/artiq/compiler/targets.py index 34f85d85f..ba79e0121 100644 --- a/artiq/compiler/targets.py +++ b/artiq/compiler/targets.py @@ -46,12 +46,14 @@ class RunTool: def _dump(target, kind, suffix, content): if target is not None: print("====== {} DUMP ======".format(kind.upper()), file=sys.stderr) - content_bytes = bytes(content(), 'utf-8') + content_value = content() + if isinstance(content_value, str): + content_value = bytes(content_value, 'utf-8') if target == "": file = tempfile.NamedTemporaryFile(suffix=suffix, delete=False) else: file = open(target + suffix, "wb") - file.write(content_bytes) + file.write(content_value) file.close() print("{} dumped as {}".format(kind, file.name), file=sys.stderr)