Towards syncing with decompyle3

This commit is contained in:
rocky
2020-01-21 06:36:54 -05:00
parent f4e6382cc1
commit 73eab178ae
3 changed files with 23 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ SKIP_TESTS=(
[test_io.py]=1 # test takes too long to run: 34 seconds
[test_lib2to3.py]=1
[test_logging.py]=1 # test takes too long to run: 13 seconds
[test_long.py]=1 # FIX: if boundarys wrong in Rat __init__ was okay in 3.6.2 though
[test_long.py]=1 # FIX: if boundaries wrong in Rat __init__ was okay in 3.6.2 though
[test_math.py]=1
[test_modulefinder.py]=1
[test_multiprocessing.py]=1

View File

@@ -132,6 +132,6 @@ SKIP_TESTS=(
[test_winreg.py]=1 # it fails on its own
[test_winsound.py]=1 # it fails on its own
[test_zipfile.py]=1 # it fails on its own
[test_zipfile64.py]=1 #
[test_zipfile64.py]=1 # Too long to run
)
# 268 Remaining unit-test files, Elapsed time about 11 minutes

View File

@@ -58,6 +58,10 @@ class Python37Parser(Python37BaseParser):
lastc_stmt ::= forelselaststmt
lastc_stmt ::= ifelsestmtc
# Statements in a loop
lstmt ::= stmt
l_stmts ::= lstmt+
c_stmts_opt ::= c_stmts
c_stmts_opt ::= pass
@@ -425,10 +429,11 @@ class Python37Parser(Python37BaseParser):
subscript2 ::= expr expr DUP_TOP_TWO BINARY_SUBSCR
# Python 3.2+ has more loop optimization that removes
# JUMP_FORWARD in some cases, and hence we also don't
# see COME_FROM
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_froms
# FIXME: The below rule was in uncompyle6.
# In decompyle6 though "_ifstmts_jump" is part of an "ifstmt"
# where as the below rule is appropriate for an "ifelsesmt"
# Investigate and reconcile
# _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_froms
kv3 ::= expr expr STORE_MAP
"""
@@ -511,6 +516,11 @@ class Python37Parser(Python37BaseParser):
ifelsestmtc ::= testexpr c_stmts_opt JUMP_FORWARD else_suitec
ifelsestmtl ::= testexpr c_stmts_opt jb_else else_suitel
# We want to keep the positions of the "then" and
# "else" statements in "ifelstmtl" similar to others of this ilk.
testexpr_cf ::= testexpr come_froms
ifelsestmtl ::= testexpr_cf c_stmts_opt jb_else else_suitel
# 3.5 Has jump optimization which can route the end of an
# "if/then" back to to a loop just before an else.
jump_absolute_else ::= jb_else
@@ -763,8 +773,15 @@ class Python37Parser(Python37BaseParser):
stmt ::= assert2
assert2 ::= expr jmp_true LOAD_GLOBAL expr CALL_FUNCTION_1 RAISE_VARARGS_1
# "assert_invert" tests on the negative of the condition given
stmt ::= assert_invert
assert_invert ::= testtrue LOAD_GLOBAL RAISE_VARARGS_1
expr ::= LOAD_ASSERT
# FIXME: add this:
# expr ::= assert_expr_or
ifstmt ::= testexpr _ifstmts_jump
testexpr ::= testfalse