From 71737e85114ae75f577155934872e99e1f8488fc Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 5 Apr 2024 17:53:17 +0900 Subject: [PATCH] =?UTF-8?q?Python3=20-c=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aheui/aheui.py | 3 ++- aheui/option.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/aheui/aheui.py b/aheui/aheui.py index b2276c8..e399dda 100644 --- a/aheui/aheui.py +++ b/aheui/aheui.py @@ -454,7 +454,8 @@ def prepare_compiler(contents, opt_level=2, source='code', aheuic_output=None, a elif source == 'asm': compiler.read_asm(contents.decode('utf-8')) else: - compiler.compile(contents.decode('utf-8'), add_debug_info=add_debug_info) + contents = contents.decode('utf-8') + compiler.compile(contents, add_debug_info=add_debug_info) if opt_level == 0: pass diff --git a/aheui/option.py b/aheui/option.py index 676dec0..aff6e5f 100644 --- a/aheui/option.py +++ b/aheui/option.py @@ -4,7 +4,7 @@ import os from aheui._argparse import ArgumentParser -from aheui._compat import bigint +from aheui._compat import bigint, PY3 from aheui.version import VERSION from aheui import compile @@ -89,6 +89,8 @@ def open_r(filename): if len(args) != 1: os.write(2, b'aheui: error: --cmd,-c but input file found\n') raise SystemExit() + if PY3: + cmd = cmd.encode('utf-8') contents = cmd filename = '-' @@ -100,7 +102,7 @@ def open_r(filename): source = 'bytecode' elif filename.endswith('.aheuis'): source = 'asm' - elif '\xff\xff\xff\xff' in contents: + elif b'\xff\xff\xff\xff' in contents: source = 'bytecode' else: source = 'text'