You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Another 3.5+ erroneous RETURN_END_IF misclassify
This commit is contained in:
Binary file not shown.
@@ -10,3 +10,15 @@ def parseline(self, line):
|
||||
else:
|
||||
return 3 if line[3] else 4
|
||||
return 6
|
||||
|
||||
# From 3.5 gettext.py
|
||||
# In the below code, the "return" was erroneously
|
||||
# classifying RETURN_END_IF instead of RETURN_VALUE
|
||||
def find(domain):
|
||||
for lang in domain:
|
||||
if lang:
|
||||
if all:
|
||||
domain.append(5)
|
||||
else:
|
||||
return lang
|
||||
return domain
|
||||
|
@@ -779,10 +779,22 @@ class Scanner3(Scanner):
|
||||
self.fixed_jumps[offset] = unop_target
|
||||
else:
|
||||
self.fixed_jumps[offset] = self.restrict_to_parent(target, parent)
|
||||
elif op == self.opc.JUMP_FORWARD and self.version >= 3.5:
|
||||
pass
|
||||
pass
|
||||
elif self.version >= 3.5:
|
||||
# 3.5+ has Jump optimization which too often causes RETURN_VALUE to get
|
||||
# misclassified as RETURN_END_IF. Handle that here.
|
||||
# In RETURN_VALUE, JUMP_ABSOLUTE, RETURN_VALUE is never RETURN_END_IF
|
||||
if op == self.opc.RETURN_VALUE:
|
||||
if (offset+1 < len(code) and code[offset+1] == self.opc.JUMP_ABSOLUTE and
|
||||
offset in self.return_end_ifs):
|
||||
self.return_end_ifs.remove(offset)
|
||||
pass
|
||||
pass
|
||||
elif op == self.opc.JUMP_FORWARD:
|
||||
# If we have:
|
||||
# JUMP_FORWARD x, [non-jump, insns], RETURN_VALUE, x:
|
||||
# then RETURN_VALUE is probably not RETURN_END_IF
|
||||
# then RETURN_VALUE is not RETURN_END_IF
|
||||
rtarget = self.get_target(offset)
|
||||
rtarget_prev = self.prev[rtarget]
|
||||
if (code[rtarget_prev] == self.opc.RETURN_VALUE and
|
||||
|
Reference in New Issue
Block a user