You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Fix bug introduced by a recent refactoring
This commit is contained in:
@@ -120,7 +120,6 @@ SKIP_TESTS=(
|
|||||||
[test_types.py]=1 # parse error
|
[test_types.py]=1 # parse error
|
||||||
[test_unicode.py]=1 # unicode thing
|
[test_unicode.py]=1 # unicode thing
|
||||||
[test_urllib2.py]=1 #
|
[test_urllib2.py]=1 #
|
||||||
[test_urllib2net.py]=1 # Investigate: Was working in 3.6.2. parse error.
|
|
||||||
[test_urllib2_localnet.py]=1 #
|
[test_urllib2_localnet.py]=1 #
|
||||||
[test_urllibnet.py]=1 # probably control flow - uninitialized variable
|
[test_urllibnet.py]=1 # probably control flow - uninitialized variable
|
||||||
[test_weakref.py]=1 # probably control flow - uninitialized variable
|
[test_weakref.py]=1 # probably control flow - uninitialized variable
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
# Copyright (c) 2020 Rocky Bernstein
|
# Copyright (c) 2020 Rocky Bernstein
|
||||||
|
|
||||||
|
|
||||||
def ifstmt(self, lhs, n, rule, ast, tokens, first, last):
|
def ifstmt(self, lhs, n, rule, ast, tokens, first, last):
|
||||||
if lhs == "ifstmtl":
|
if lhs == "ifstmtl":
|
||||||
if last == n:
|
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_"):
|
if len(test) > 1 and test[1].kind.startswith("jmp_"):
|
||||||
jmp_target = test[1][0].attr
|
jmp_target = test[1][0].attr
|
||||||
if (
|
if (
|
||||||
tokens[first].off2int(True)
|
tokens[first].off2int(prefer_last=True)
|
||||||
<= jmp_target
|
<= jmp_target
|
||||||
< tokens[last].off2int(False)
|
< tokens[last].off2int(prefer_last=False)
|
||||||
):
|
):
|
||||||
return True
|
return True
|
||||||
# jmp_target less than tokens[first] is okay - is to a loop
|
# jmp_target less than tokens[first] is okay - is to a loop
|
||||||
|
@@ -187,7 +187,7 @@ class Token:
|
|||||||
raise IndexError
|
raise IndexError
|
||||||
|
|
||||||
def off2int(self, prefer_last=True):
|
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)
|
NoneToken = Token("LOAD_CONST", offset=-1, attr=None, pattr=None)
|
||||||
|
Reference in New Issue
Block a user