Skip to content

Commit

Permalink
pypy 7.3 호환
Browse files Browse the repository at this point in the history
bytes/unicode 비교를 제거하고 발생하지 않는 None을 narrow합니다
  • Loading branch information
youknowone committed Mar 31, 2024
1 parent 52007fd commit 68087b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- uses: actions/checkout@master
with:
repository: pypy/pypy
ref: release-pypy2.7-v7.0.0
ref: release-pypy2.7-v7.3.13
- name: Build
run: |
RPYTHON=pypy/pypy/rpython/bin/rpython make
Expand Down
5 changes: 3 additions & 2 deletions aheui/aheui.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def get_location(pc, stackok, is_queue, program):
"""
op = program.get_op(pc)
val = ('_%d' % program.get_operand(pc)) if compile.OP_USEVAL[op] else ''
op_name = compile.OP_NAMES[op].encode('utf-8')
return "#%d(s%dq%d)_%s%s" % (pc, stackok, is_queue, op_name, val)
op_name = compile.OP_NAMES[op]
assert op_name is not None
return "#%d(s%dq%d)_%s%s" % (pc, stackok, is_queue, op_name.encode('utf-8'), val)


driver = jit.JitDriver(
Expand Down
7 changes: 4 additions & 3 deletions aheui/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,23 @@ def __init__(self, text):
pc_col = 0
max_col = 0
for char in self.text:
if char == '\n':
if char == u'\n':
pc_row += 1
max_col = max(max_col, pc_col)
pc_col = 0
continue
if u'가' <= char <= u'힣':
self.pane[pc_row, pc_col] = char
else:
self.pane[pc_row, pc_col] = '\0' # to mark empty space
self.pane[pc_row, pc_col] = u'\0' # to mark empty space
pc_col += 1
max_col = max(max_col, pc_col)

self.max_row = pc_row
self.max_col = max_col

def decode(self, position):
code = self.pane.get(position, '\0')
code = self.pane.get(position, u'\0')
if code == u'\0':
return c.OP_NONE, MV_NONE, -1 # do nothing
base = ord(code) - ord(u'가')
Expand Down Expand Up @@ -848,6 +848,7 @@ def write_asm(self, fp=1, commented=True):
else:
codes.append(u' ' * 8)
code = OP_NAMES[op]
assert code is not None
if len(code.encode('utf-8')) == 3:
code += u' '
if code is None:
Expand Down

0 comments on commit 68087b5

Please sign in to comment.