8000 tools/mpy-tool.py: Fix init of QStrWindow, and remove unused variable. · rlucia/micropython@74ed068 · GitHub
[go: up one dir, main page]

Skip to content

Commit 74ed068

Browse files
committed
tools/mpy-tool.py: Fix init of QStrWindow, and remove unused variable.
The qstr window size is not log-2 encoded, it's just the actual number (but in mpy-tool.py this didn't lead to an error because the size is just used to truncate the window so it doesn't grow arbitrarily large in memory). Addresses issue micropython#4635.
1 parent 4831e38 commit 74ed068

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tools/mpy-tool.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ def __init__(self, str):
7575
global_qstrs.append(QStrType(n))
7676

7777
class QStrWindow:
78-
def __init__(self, size_log2):
78+
def __init__(self, size):
7979
self.window = []
80-
self.size = 1 << size_log2
80+
self.size = size
8181

8282
def push(self, val):
8383
self.window = [val] + self.window[:self.size - 1]
@@ -633,7 +633,6 @@ def read_qstr_and_pack(f, bytecode, qstr_win):
633633
bytecode.append(qst >> 8)
634634

635635
def read_bytecode(file, bytecode, qstr_win):
636-
QSTR_LAST_STATIC = len(qstrutil.static_qstr_list)
637636
while not bytecode.is_full():
638637
op = read_byte(file, bytecode)
639638
f, sz = mp_opcode_format(bytecode.buf, bytecode.idx - 1, False)

0 commit comments

Comments
 (0)
0