Skip to content

Commit 99ab64f

Browse files
committed
py/makeqstrdata.py: Make it work again with both Python2 and Python3.
1 parent 95836f8 commit 99ab64f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

py/makeqstrdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def do_work(infiles):
9292
if qlen >= cfg_max_len:
9393
print('qstr is too long:', qstr)
9494
assert False
95-
qlen_str = ('\\x%02x' * cfg_bytes_len) % tuple(qlen.to_bytes(cfg_bytes_len, 'little'))
95+
qlen_str = ('\\x%02x' * cfg_bytes_len) % tuple(((qlen >> (8 * i)) & 0xff) for i in range(cfg_bytes_len))
9696
print('QDEF(MP_QSTR_%s, (const byte*)"\\x%02x\\x%02x%s" "%s")' % (ident, qhash & 0xff, (qhash >> 8) & 0xff, qlen_str, qdata))
9797

9898
return True

0 commit comments

Comments
 (0)