You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Narrow what's excepted for iflastsmtl...
Disallow "if" jump to jump inside body of "then".
This commit is contained in:
@@ -75,7 +75,7 @@ case $PYVERSION in
|
|||||||
[test_codeccallbacks.py]=1 # Fails on its own
|
[test_codeccallbacks.py]=1 # Fails on its own
|
||||||
[test_compile.py]=1 # Intermittent - sometimes works and sometimes doesn't
|
[test_compile.py]=1 # Intermittent - sometimes works and sometimes doesn't
|
||||||
[test_exceptions.py]=1
|
[test_exceptions.py]=1
|
||||||
[test_generators.py]=1 # Investigate
|
[test_generators.py]=1 # Investigate. Recently fixed in 2.7? Fixed with reduction checks?
|
||||||
[test_grp.py]=1 # Long test - might work Control flow?
|
[test_grp.py]=1 # Long test - might work Control flow?
|
||||||
[test_pep352.py]=1 # Investigate
|
[test_pep352.py]=1 # Investigate
|
||||||
[test_pprint.py]=1
|
[test_pprint.py]=1
|
||||||
@@ -125,10 +125,8 @@ case $PYVERSION in
|
|||||||
[test_doctest.py]=1 # Fails on its own
|
[test_doctest.py]=1 # Fails on its own
|
||||||
[test_exceptions.py]=1
|
[test_exceptions.py]=1
|
||||||
[test_format.py]=1 # control flow. uncompyle2 does not have problems here
|
[test_format.py]=1 # control flow. uncompyle2 does not have problems here
|
||||||
[test_generators.py]=1 # control flow. uncompyle2 has problem here too
|
|
||||||
[test_grammar.py]=1 # Too many stmts. Handle large stmts
|
[test_grammar.py]=1 # Too many stmts. Handle large stmts
|
||||||
[test_grp.py]=1 # test takes to long, works interactively though
|
[test_grp.py]=1 # test takes to long, works interactively though
|
||||||
[test_hashlib.py]=1 # Investigate
|
|
||||||
[test_io.py]=1 # Test takes too long to run
|
[test_io.py]=1 # Test takes too long to run
|
||||||
[test_ioctl.py]=1 # Test takes too long to run
|
[test_ioctl.py]=1 # Test takes too long to run
|
||||||
[test_long.py]=1
|
[test_long.py]=1
|
||||||
|
@@ -285,10 +285,10 @@ class Python27Parser(Python2Parser):
|
|||||||
or jump_target == next_offset(ast[-1].op, ast[-1].opc, ast[-1].offset))
|
or jump_target == next_offset(ast[-1].op, ast[-1].opc, ast[-1].offset))
|
||||||
elif rule == ("iflaststmtl", ("testexpr", "c_stmts")):
|
elif rule == ("iflaststmtl", ("testexpr", "c_stmts")):
|
||||||
testexpr = ast[0]
|
testexpr = ast[0]
|
||||||
if testexpr[0] == "testfalse":
|
if testexpr[0] in ("testfalse", "testtrue"):
|
||||||
testfalse = testexpr[0]
|
test = testexpr[0]
|
||||||
if testfalse[1] == "jmp_false":
|
if len(test) > 1 and test[1].kind.startswith("jmp_"):
|
||||||
jmp_false = testfalse[1]
|
jmp_target = test[1][0].attr
|
||||||
if last == len(tokens):
|
if last == len(tokens):
|
||||||
last -= 1
|
last -= 1
|
||||||
while (isinstance(tokens[first].offset, str) and first < last):
|
while (isinstance(tokens[first].offset, str) and first < last):
|
||||||
@@ -297,7 +297,7 @@ class Python27Parser(Python2Parser):
|
|||||||
return True
|
return True
|
||||||
while (first < last and isinstance(tokens[last].offset, str)):
|
while (first < last and isinstance(tokens[last].offset, str)):
|
||||||
last -= 1
|
last -= 1
|
||||||
return tokens[first].offset < jmp_false[0].attr < tokens[last].offset
|
return tokens[first].off2int() < jmp_target < tokens[last].off2int()
|
||||||
pass
|
pass
|
||||||
pass
|
pass
|
||||||
pass
|
pass
|
||||||
|
Reference in New Issue
Block a user