Fix bug introduced by a recent refactoring

This commit is contained in:
rocky
2020-01-24 03:11:51 -05:00
parent 7e91daf043
commit 4067a30573
4 changed files with 4 additions and 4 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)