Fix gbz80 code search on PyPy

It doesn't support % on bytestrings yet, alas.
This commit is contained in:
Eevee (Lexy Munroe) 2016-12-19 16:07:59 -08:00
parent a6c63733f0
commit 508b5cd88f

View file

@ -625,8 +625,9 @@ def find_code(haystack, needle, **kwargs):
inner_pattern = b'.' * instr_input.length inner_pattern = b'.' * instr_input.length
group_name = pattern_atom.name.encode('ascii') group_name = pattern_atom.name.encode('ascii')
input_table[pattern_atom.name] = b'(?P=%b)' % (group_name,) input_table[pattern_atom.name] = b'(?P=' + group_name + b')'
pattern_chunks.append(b'(?P<%b>%b)' % (group_name, inner_pattern)) pattern_chunks.append(
b'(?P<' + group_name + b'>' + inner_pattern + b')')
matched_instructions.append((instr, pattern_atoms)) matched_instructions.append((instr, pattern_atoms))
pattern = b''.join(pattern_chunks) pattern = b''.join(pattern_chunks)