tools/mpy-tool.py: Fix frozen comment generation to escape chars.

That caused the compile of frozen_content.c to fail if characters like
backslash were in a short string.  Thanks to @hippy for identifying the
spot to change.
This commit is contained in:
robert-hh 2022-02-26 07:55:53 +01:00 committed by Damien George
parent 0a217624e1
commit 5c46721a1c
1 changed files with 1 additions and 1 deletions

View File

@ -861,7 +861,7 @@ class RawCodeBytecode(RawCode):
fmt, sz, arg = mp_opcode_decode(bc, ip) fmt, sz, arg = mp_opcode_decode(bc, ip)
opcode_name = Opcodes.mapping[bc[ip]] opcode_name = Opcodes.mapping[bc[ip]]
if fmt == MP_BC_FORMAT_QSTR: if fmt == MP_BC_FORMAT_QSTR:
opcode_name += " " + self.qstr_table[arg].str opcode_name += " " + repr(self.qstr_table[arg].str)
elif fmt in (MP_BC_FORMAT_VAR_UINT, MP_BC_FORMAT_OFFSET): elif fmt in (MP_BC_FORMAT_VAR_UINT, MP_BC_FORMAT_OFFSET):
opcode_name += " %u" % arg opcode_name += " %u" % arg
print( print(