diff --git a/test/simple_source/bug36/01_fstring.py b/test/simple_source/bug36/01_fstring.py index 728add4b..dd19861e 100644 --- a/test/simple_source/bug36/01_fstring.py +++ b/test/simple_source/bug36/01_fstring.py @@ -1,6 +1,7 @@ # Self-checking test. # String interpolation tests +# RUNNABLE! var1 = 'x' var2 = 'y' abc = 'def' diff --git a/test/simple_source/bug36/01_if_and_if_bug.py b/test/simple_source/bug36/01_if_and_if_bug.py index 9a529595..8e2b0fe5 100644 --- a/test/simple_source/bug36/01_if_and_if_bug.py +++ b/test/simple_source/bug36/01_if_and_if_bug.py @@ -1,6 +1,7 @@ # Bug in 3.6 was not taking "else" branch after compond "if" # In earlier versions we had else detection needed here. +# RUNNABLE! def f(a, b, c): if a and b: x = 1 diff --git a/test/simple_source/bug36/02_call_ex_kw.py b/test/simple_source/bug36/02_call_ex_kw.py index bb4fc699..c598e78c 100644 --- a/test/simple_source/bug36/02_call_ex_kw.py +++ b/test/simple_source/bug36/02_call_ex_kw.py @@ -4,6 +4,7 @@ # showparams(c, test="A", **extra_args) # below +# RUNNABLE! def showparams(c, test, **extra_args): return {'c': c, **extra_args, 'test': test} @@ -44,4 +45,3 @@ d = (2, 3) assert f(2, **a) == {'c': 2, 'param1': 2, 'test': 'A'} assert f3(2, *c, **a) == {'c': 2, 'param1': 2, 'test': 2} assert f3(*d, **a) == {'c': 2, 'param1': 2, 'test': 3} - diff --git a/uncompyle6/parsers/parse38.py b/uncompyle6/parsers/parse38.py index 3aa235ba..c82120c8 100644 --- a/uncompyle6/parsers/parse38.py +++ b/uncompyle6/parsers/parse38.py @@ -37,7 +37,9 @@ class Python38Parser(Python37Parser): stmt ::= forelsestmt38 stmt ::= forelselaststmt38 stmt ::= forelselaststmtl38 - stmt ::= tryfinally38 + stmt ::= tryfinally38stmt + stmt ::= tryfinally38rstmt + stmt ::= tryfinally38astmt stmt ::= try_elsestmtl38 stmt ::= try_except_ret38 stmt ::= try_except38 @@ -167,17 +169,22 @@ class Python38Parser(Python37Parser): tryfinallystmt ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK BEGIN_FINALLY COME_FROM_FINALLY suite_stmts_opt END_FINALLY - tryfinally38 ::= SETUP_FINALLY POP_BLOCK CALL_FINALLY + tryfinally38rstmt ::= SETUP_FINALLY POP_BLOCK CALL_FINALLY returns COME_FROM_FINALLY END_FINALLY suite_stmts - tryfinally38 ::= SETUP_FINALLY POP_BLOCK CALL_FINALLY + tryfinally38rstmt ::= SETUP_FINALLY POP_BLOCK CALL_FINALLY returns COME_FROM_FINALLY POP_FINALLY returns END_FINALLY - tryfinally_return_stmt ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK - BEGIN_FINALLY COME_FROM_FINALLY - POP_FINALLY suite_stmts_opt END_FINALLY - + tryfinally38stmt ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK + BEGIN_FINALLY COME_FROM_FINALLY + POP_FINALLY suite_stmts_opt END_FINALLY + tryfinally38stmt ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK + BEGIN_FINALLY COME_FROM_FINALLY + POP_FINALLY suite_stmts_opt END_FINALLY + tryfinally38astmt ::= LOAD_CONST SETUP_FINALLY suite_stmts_opt POP_BLOCK + BEGIN_FINALLY COME_FROM_FINALLY + POP_FINALLY POP_TOP suite_stmts_opt END_FINALLY POP_TOP """ def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG): diff --git a/uncompyle6/semantics/customize38.py b/uncompyle6/semantics/customize38.py index f21ba083..9795088e 100644 --- a/uncompyle6/semantics/customize38.py +++ b/uncompyle6/semantics/customize38.py @@ -104,9 +104,17 @@ def customize_for_version38(self, version): 'try_except_ret38': ( '%|try:\n%+%|return %c%-\n%|except:\n%+%|%c%-\n\n', (1, 'expr'), (-1, 'except_ret38a') ), - 'tryfinally38': ( + 'tryfinally38rstmt': ( '%|try:\n%+%c%-%|finally:\n%+%c%-\n\n', (3, 'returns'), 6 ), + 'tryfinally38stmt': ( + '%|try:\n%+%c%-%|finally:\n%+%c%-\n\n', + (1, "suite_stmts_opt"), + (6, "suite_stmts_opt") ), + 'tryfinally38_return_stmt': ( + '%|try:\n%+%c%-%|finally:\n%+%c%-\n\n', + (2, "suite_stmts_opt"), + (8, "suite_stmts_opt") ), "named_expr": ( # AKA "walrus operator" "%c := %c", (2, "store"), (0, "expr") )