Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions depyf/decompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,13 @@
self.state.stack[- n] = value

def COPY(self, inst: Instruction):
# not tested, don't know how to generate this instruction
n = inst.argval
value = self.state.stack[-1 - n]
# COPY argument is 1-based
# see https://discuss.python.org/t/the-oparg-of-the-new-copy-opcode-is-not-zero-based/22110
# n == 0 is a silent error and will be ignored by the interpreter
if n == 0:
return

Check warning on line 816 in depyf/decompiler.py

View check run for this annotation

Codecov / codecov/patch

depyf/decompiler.py#L816

Added line #L816 was not covered by tests
value = self.state.stack[-1 - (n - 1)]
self.state.stack.append(value)

def POP_TOP(self, inst: Instruction):
Expand Down