You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Fix else detection bug in Python 3.6+
This commit is contained in:
@@ -57,7 +57,7 @@ entry_points = {
|
|||||||
]}
|
]}
|
||||||
ftp_url = None
|
ftp_url = None
|
||||||
install_requires = ['spark-parser >= 1.8.7, < 1.9.0',
|
install_requires = ['spark-parser >= 1.8.7, < 1.9.0',
|
||||||
'xdis >= 3.8.10, < 3.9.0']
|
'xdis >= 3.9.0, < 3.10.0']
|
||||||
|
|
||||||
license = 'GPL3'
|
license = 'GPL3'
|
||||||
mailing_list = 'python-debugger@googlegroups.com'
|
mailing_list = 'python-debugger@googlegroups.com'
|
||||||
|
@@ -609,7 +609,9 @@ class Scanner3(Scanner):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
code = self.code
|
code = self.code
|
||||||
op = self.insts[inst_index].opcode
|
inst = self.insts[inst_index]
|
||||||
|
op = inst.opcode
|
||||||
|
|
||||||
|
|
||||||
# Detect parent structure
|
# Detect parent structure
|
||||||
parent = self.structs[0]
|
parent = self.structs[0]
|
||||||
@@ -632,7 +634,7 @@ class Scanner3(Scanner):
|
|||||||
# Try to find the jump_back instruction of the loop.
|
# Try to find the jump_back instruction of the loop.
|
||||||
# It could be a return instruction.
|
# It could be a return instruction.
|
||||||
|
|
||||||
start += instruction_size(op, self.opc)
|
start += inst.inst_size
|
||||||
target = self.get_target(offset)
|
target = self.get_target(offset)
|
||||||
end = self.restrict_to_parent(target, parent)
|
end = self.restrict_to_parent(target, parent)
|
||||||
self.setup_loops[target] = offset
|
self.setup_loops[target] = offset
|
||||||
@@ -718,8 +720,8 @@ class Scanner3(Scanner):
|
|||||||
'start': after_jump_offset,
|
'start': after_jump_offset,
|
||||||
'end': end})
|
'end': end})
|
||||||
elif op in self.pop_jump_tf:
|
elif op in self.pop_jump_tf:
|
||||||
start = offset + instruction_size(op, self.opc)
|
start = offset + inst.inst_size
|
||||||
target = self.insts[inst_index].argval
|
target = inst.argval
|
||||||
rtarget = self.restrict_to_parent(target, parent)
|
rtarget = self.restrict_to_parent(target, parent)
|
||||||
prev_op = self.prev_op
|
prev_op = self.prev_op
|
||||||
|
|
||||||
@@ -757,7 +759,7 @@ class Scanner3(Scanner):
|
|||||||
pre_rtarget = prev_op[rtarget]
|
pre_rtarget = prev_op[rtarget]
|
||||||
|
|
||||||
# Is it an "and" inside an "if" or "while" block
|
# Is it an "and" inside an "if" or "while" block
|
||||||
if op == self.opc.POP_JUMP_IF_FALSE and self.version < 3.6:
|
if op == self.opc.POP_JUMP_IF_FALSE:
|
||||||
|
|
||||||
# Search for another POP_JUMP_IF_FALSE targetting the same op,
|
# Search for another POP_JUMP_IF_FALSE targetting the same op,
|
||||||
# in current statement, starting from current offset, and filter
|
# in current statement, starting from current offset, and filter
|
||||||
|
Reference in New Issue
Block a user