You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Merge branch 'master' into python-3.3-to-3.5
This commit is contained in:
BIN
test/bytecode_3.5/02_for_else_bug.pyc
Normal file
BIN
test/bytecode_3.5/02_for_else_bug.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.6/09_long_whilestmt.pyc
Normal file
BIN
test/bytecode_3.6/09_long_whilestmt.pyc
Normal file
Binary file not shown.
74
test/simple_source/bug36/09_long_whilestmt.py
Normal file
74
test/simple_source/bug36/09_long_whilestmt.py
Normal file
@@ -0,0 +1,74 @@
|
||||
# From https://github.com/rocky/python-uncompyle6/issues/420
|
||||
# Related to EXTENDED_ARG in whilestmt
|
||||
ERRPR_CODE_DEFINE = {} # Remove this and things works
|
||||
|
||||
try:
|
||||
print()
|
||||
except Exception:
|
||||
var1 = 0
|
||||
var2 = 1
|
||||
if var1 or var2:
|
||||
times = 1
|
||||
while times != False and self.scanner.is_open():
|
||||
try:
|
||||
try:
|
||||
print()
|
||||
except Exception:
|
||||
print()
|
||||
|
||||
out = 0
|
||||
count = 1
|
||||
if out == 1:
|
||||
break
|
||||
elif out == 2:
|
||||
count += 1
|
||||
if times == 3:
|
||||
self.func.emit({})
|
||||
break
|
||||
else:
|
||||
continue
|
||||
if out == 3 or out == b"":
|
||||
if self.times == 3:
|
||||
break
|
||||
count += 1
|
||||
if count == 3:
|
||||
count = 0
|
||||
if out == 4:
|
||||
self.func.emit(ERRPR_CODE_DEFINE.ReceiedError())
|
||||
else:
|
||||
print()
|
||||
break
|
||||
continue
|
||||
else:
|
||||
count = 0
|
||||
except Exception:
|
||||
print("upper exception")
|
||||
else:
|
||||
try:
|
||||
print("jump forward")
|
||||
while True:
|
||||
out = self.func.read(count)
|
||||
if out == b"":
|
||||
self.func.emit(ERRPR_CODE_DEFINE.ReceiedError())
|
||||
break
|
||||
continue
|
||||
imagedata = out[0]
|
||||
if imagedata == b"\x05":
|
||||
self.func.emit(INFORMATION.UnsupportedImage())
|
||||
break
|
||||
continue
|
||||
if imagedata == b"\x15":
|
||||
self.func.emit(INFORMATION.NoneImage())
|
||||
break
|
||||
continue
|
||||
if out[1] == False:
|
||||
start_index = imagedata.find(b"BM6")
|
||||
self.func.emit(imagedata[start_index:], False)
|
||||
continue
|
||||
(imagedata, all_code) = imagedata
|
||||
self.func.emit({})
|
||||
self.func.emit({})
|
||||
self.func.emit({}) # remove {} and this works
|
||||
break
|
||||
except Exception:
|
||||
pass
|
@@ -53,6 +53,10 @@ class Python34Parser(Python33Parser):
|
||||
_ifstmts_jump ::= c_stmts_opt JUMP_ABSOLUTE JUMP_FORWARD COME_FROM
|
||||
|
||||
genexpr_func ::= LOAD_ARG _come_froms FOR_ITER store comp_iter JUMP_BACK
|
||||
|
||||
if_exp_lambda ::= expr jmp_false expr return_if_lambda come_froms return_stmt_lambda LAMBDA_MARKER
|
||||
|
||||
return_if_stmt ::= return_expr RETURN_END_IF POP_BLOCK
|
||||
"""
|
||||
|
||||
def customize_grammar_rules(self, tokens, customize):
|
||||
|
@@ -108,7 +108,6 @@ class Python35Parser(Python34Parser):
|
||||
# Python 3.5+ does jump optimization
|
||||
# In <.3.5 the below is a JUMP_FORWARD to a JUMP_ABSOLUTE.
|
||||
|
||||
return_if_stmt ::= return_expr RETURN_END_IF POP_BLOCK
|
||||
return_if_lambda ::= RETURN_END_IF_LAMBDA COME_FROM
|
||||
|
||||
return ::= return_expr RETURN_END_IF
|
||||
|
@@ -53,6 +53,8 @@ class Python36Parser(Python35Parser):
|
||||
for_block ::= l_stmts_opt come_from_loops JUMP_BACK
|
||||
come_from_loops ::= COME_FROM_LOOP*
|
||||
|
||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt
|
||||
JUMP_BACK come_froms POP_BLOCK
|
||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt
|
||||
JUMP_BACK come_froms POP_BLOCK COME_FROM_LOOP
|
||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt
|
||||
|
Reference in New Issue
Block a user