You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Back off unconditional_true test for now - Sigh
This commit is contained in:
BIN
test/bytecode_2.7_run/05_not_unconditional.pyc-notyet
Normal file
BIN
test/bytecode_2.7_run/05_not_unconditional.pyc-notyet
Normal file
Binary file not shown.
12
test/simple_source/bug27+/05_not_unconditional.py
Normal file
12
test/simple_source/bug27+/05_not_unconditional.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# From 2.7 test_itertools.py
|
||||
# Bug was in 2.7 decompiling like the commented out
|
||||
# code below
|
||||
from itertools import izip_longest
|
||||
for args in [
|
||||
['abc', range(6)],
|
||||
]:
|
||||
# target = [tuple([ arg[i] if 1 else None for arg in args if i < len(arg) ])
|
||||
# for i in range(max(map(len, args)))]
|
||||
target = [tuple([arg[i] if i < len(arg) else None for arg in args])
|
||||
for i in range(max(map(len, args)))]
|
||||
assert list(izip_longest(*args)) == target
|
@@ -71,6 +71,8 @@ case $PYVERSION in
|
||||
[test_grammar.py]=1 # Too many stmts. Handle large stmts
|
||||
[test_io.py]=1 # Test takes too long to run
|
||||
[test_ioctl.py]=1 # Test takes too long to run
|
||||
[test_itertools.py]=1 # Fix erroneous reduction to "conditional_true".
|
||||
# See test/simple_source/bug27+/05_not_unconditional.py
|
||||
[test_memoryio.py]=1 # FIX
|
||||
[test_multiprocessing.py]=1 # On uncompyle2, taks 24 secs
|
||||
[test_pep352.py]=1 # ?
|
||||
|
@@ -170,7 +170,7 @@ class Python27Parser(Python2Parser):
|
||||
""")
|
||||
super(Python27Parser, self).customize_grammar_rules(tokens, customize)
|
||||
self.check_reduce['and'] = 'AST'
|
||||
self.check_reduce['conditional_true'] = 'AST'
|
||||
# self.check_reduce['conditional_true'] = 'AST'
|
||||
return
|
||||
|
||||
def reduce_is_invalid(self, rule, ast, tokens, first, last):
|
||||
@@ -186,11 +186,11 @@ class Python27Parser(Python2Parser):
|
||||
jmp_target = jmp_false.offset + jmp_false.attr + 3
|
||||
return not (jmp_target == tokens[last].offset or
|
||||
tokens[last].pattr == jmp_false.pattr)
|
||||
elif rule[0] == ('conditional_true'):
|
||||
# FIXME: the below is a hack: we check expr for
|
||||
# nodes that could have possibly been a been a Boolean.
|
||||
# We should also look for the presence of dead code.
|
||||
return ast[0] == 'expr' and ast[0] == 'or'
|
||||
# elif rule[0] == ('conditional_true'):
|
||||
# # FIXME: the below is a hack: we check expr for
|
||||
# # nodes that could have possibly been a been a Boolean.
|
||||
# # We should also look for the presence of dead code.
|
||||
# return ast[0] == 'expr' and ast[0] == 'or'
|
||||
|
||||
return False
|
||||
|
||||
|
Reference in New Issue
Block a user