From 7fa851765d1227faa12e2ea5533e7f430fa0d87b Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 18 May 2020 22:54:08 -0400 Subject: [PATCH] Regularize "or" so args are in 1..2 and ... correct "return None" semantic action --- test/.gitignore | 2 ++ uncompyle6/parsers/parse37.py | 4 ++-- uncompyle6/semantics/pysource.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/.gitignore b/test/.gitignore index c9c11005..001956b2 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -2,5 +2,7 @@ /.python-version /nohup.out /pycdc +/test_pycdc_tests.sh +/test_uncompyle2.py /test_unpy33.py /test_unpy37.py diff --git a/uncompyle6/parsers/parse37.py b/uncompyle6/parsers/parse37.py index 76c4bdbf..11c1967a 100644 --- a/uncompyle6/parsers/parse37.py +++ b/uncompyle6/parsers/parse37.py @@ -956,8 +956,8 @@ class Python37Parser(Python37BaseParser): and ::= expr JUMP_IF_FALSE_OR_POP expr come_from_opt and ::= expr jifop_come_from expr - pjit_come_from ::= POP_JUMP_IF_TRUE COME_FROM - or ::= expr pjit_come_from expr + expr_pjit_come_from ::= expr POP_JUMP_IF_TRUE COME_FROM + or ::= expr_pjit_come_from expr ## Note that "jmp_false" is what we check on in the "and" reduce rule. and ::= expr jmp_false expr COME_FROM diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 20330472..8b25338f 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -516,7 +516,7 @@ class SourceWalker(GenericASTTraversal, object): if self.return_none or not self.is_return_none(node): self.default(node) else: - self.template_engine(("return\n"), node) + self.template_engine(("%|return\n",), node) self.prune() # stop recursing