From 4067a3057350a66753326b33e7ac6785d2847872 Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 24 Jan 2020 03:11:51 -0500 Subject: [PATCH] Fix bug introduced by a recent refactoring --- ..._extended_arg.pyc-notyet => 01_extended_arg.pyc} | Bin test/stdlib/3.7-exclude.sh | 1 - uncompyle6/parsers/reducecheck/ifstmt.py | 5 +++-- uncompyle6/scanners/tok.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename test/bytecode_3.7/{01_extended_arg.pyc-notyet => 01_extended_arg.pyc} (100%) diff --git a/test/bytecode_3.7/01_extended_arg.pyc-notyet b/test/bytecode_3.7/01_extended_arg.pyc similarity index 100% rename from test/bytecode_3.7/01_extended_arg.pyc-notyet rename to test/bytecode_3.7/01_extended_arg.pyc diff --git a/test/stdlib/3.7-exclude.sh b/test/stdlib/3.7-exclude.sh index 8fb8aa8c..03c494ab 100644 --- a/test/stdlib/3.7-exclude.sh +++ b/test/stdlib/3.7-exclude.sh @@ -120,7 +120,6 @@ SKIP_TESTS=( [test_types.py]=1 # parse error [test_unicode.py]=1 # unicode thing [test_urllib2.py]=1 # - [test_urllib2net.py]=1 # Investigate: Was working in 3.6.2. parse error. [test_urllib2_localnet.py]=1 # [test_urllibnet.py]=1 # probably control flow - uninitialized variable [test_weakref.py]=1 # probably control flow - uninitialized variable diff --git a/uncompyle6/parsers/reducecheck/ifstmt.py b/uncompyle6/parsers/reducecheck/ifstmt.py index e0e42ac8..d31b3720 100644 --- a/uncompyle6/parsers/reducecheck/ifstmt.py +++ b/uncompyle6/parsers/reducecheck/ifstmt.py @@ -1,5 +1,6 @@ # Copyright (c) 2020 Rocky Bernstein + def ifstmt(self, lhs, n, rule, ast, tokens, first, last): if lhs == "ifstmtl": if last == n: @@ -48,9 +49,9 @@ def ifstmt(self, lhs, n, rule, ast, tokens, first, last): if len(test) > 1 and test[1].kind.startswith("jmp_"): jmp_target = test[1][0].attr if ( - tokens[first].off2int(True) + tokens[first].off2int(prefer_last=True) <= jmp_target - < tokens[last].off2int(False) + < tokens[last].off2int(prefer_last=False) ): return True # jmp_target less than tokens[first] is okay - is to a loop diff --git a/uncompyle6/scanners/tok.py b/uncompyle6/scanners/tok.py index 1fb7666e..4742af3f 100644 --- a/uncompyle6/scanners/tok.py +++ b/uncompyle6/scanners/tok.py @@ -187,7 +187,7 @@ class Token: raise IndexError def off2int(self, prefer_last=True): - return off2int(self.offset) + return off2int(self.offset, prefer_last) NoneToken = Token("LOAD_CONST", offset=-1, attr=None, pattr=None)