You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
2.6 POP_TOP and POP_JUMP_IF bugs
This commit is contained in:
@@ -27,7 +27,7 @@ from fnmatch import fnmatch
|
||||
|
||||
#----- configure this for your needs
|
||||
|
||||
TEST_VERSIONS=('2.3.7', '2.6.9', '2.7.10', '2.7.11', '3.2.6', '3.3.5', '3.4.2', '3.5.1')
|
||||
TEST_VERSIONS=('2.3.7', '2.5.6', '2.6.9', '2.7.10', '2.7.11', '3.2.6', '3.3.5', '3.4.2', '3.5.1')
|
||||
|
||||
target_base = '/tmp/py-dis/'
|
||||
lib_prefix = os.path.join(os.environ['HOME'], '.pyenv/versions')
|
||||
|
@@ -69,8 +69,12 @@ class Python26Parser(Python2Parser):
|
||||
# after one of these jumps
|
||||
def p_jumps26(self, args):
|
||||
"""
|
||||
|
||||
# The are the equivalents of Python 2.7+'s
|
||||
# POP_JUMP_IF_TRUE and POP_JUMP_IF_FALSE
|
||||
jmp_true ::= JUMP_IF_TRUE POP_TOP
|
||||
jmp_false ::= JUMP_IF_FALSE POP_TOP
|
||||
|
||||
jf_pop ::= JUMP_FORWARD come_from_pop
|
||||
jf_pop ::= JUMP_ABSOLUTE come_from_pop
|
||||
jb_pop ::= JUMP_BACK come_from_pop
|
||||
@@ -194,7 +198,7 @@ class Python26Parser(Python2Parser):
|
||||
'''
|
||||
conditional ::= expr jmp_false expr jf_cf_pop expr come_from_opt
|
||||
and ::= expr JUMP_IF_FALSE POP_TOP expr JUMP_IF_FALSE POP_TOP
|
||||
|
||||
cmp_list ::= expr cmp_list1 ROT_TWO COME_FROM POP_TOP _come_from
|
||||
'''
|
||||
|
||||
class Python26ParserSingle(Python2Parser, PythonParserSingle):
|
||||
|
@@ -438,7 +438,7 @@ class Scanner2(scan.Scanner):
|
||||
|
||||
if_offset = None
|
||||
if self.version < 2.7:
|
||||
# Look for JUMP_IF... POP_TOP
|
||||
# Look for JUMP_IF POP_TOP ...
|
||||
if (code[self.prev[next_line_byte]] == self.opc.POP_TOP
|
||||
and (code[self.prev[self.prev[next_line_byte]]]
|
||||
in self.pop_jump_if)):
|
||||
@@ -476,7 +476,12 @@ class Scanner2(scan.Scanner):
|
||||
loop_type = 'for'
|
||||
else:
|
||||
loop_type = 'while'
|
||||
if (self.version < 2.7
|
||||
and self.code[self.prev[next_line_byte]] == self.opc.POP_TOP):
|
||||
test = self.prev[self.prev[next_line_byte]]
|
||||
else:
|
||||
test = self.prev[next_line_byte]
|
||||
|
||||
if test == pos:
|
||||
loop_type = 'while 1'
|
||||
elif self.code[test] in self.opc.hasjabs + self.opc.hasjrel:
|
||||
|
Reference in New Issue
Block a user