You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
3.7 testtrue with asserts
This commit is contained in:
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
def testtrue(self, lhs, n, rule, ast, tokens, first, last):
|
def testtrue(self, lhs, n, rule, ast, tokens, first, last):
|
||||||
# FIXME: make this work for all versions
|
# FIXME: make this work for all versions
|
||||||
if self.version < 3.7:
|
if self.version != 3.7:
|
||||||
return False
|
return False
|
||||||
if rule == ("testtrue", ("expr", "jmp_true")):
|
if rule == ("testtrue", ("expr", "jmp_true")):
|
||||||
pjit = tokens[min(last-1, n-2)]
|
pjit = tokens[min(last-1, n-2)]
|
||||||
# If we have a backwards (looping) jump then this is
|
# If we have a backwards (looping) jump then this is
|
||||||
# really a testfalse
|
# really a testfalse
|
||||||
return (pjit == "POP_JUMP_IF_TRUE" and
|
if (pjit == "POP_JUMP_IF_TRUE" and
|
||||||
tokens[first].off2int() > pjit.attr)
|
tokens[first].off2int() > pjit.attr):
|
||||||
|
assert_next = tokens[min(last+1, n-1)]
|
||||||
|
return assert_next != "RAISE_VARARGS_1"
|
||||||
return False
|
return False
|
||||||
|
Reference in New Issue
Block a user