Merge branch 'master' into python-2.4

This commit is contained in:
rocky
2018-03-02 10:07:20 -05:00
4 changed files with 20 additions and 6 deletions

Binary file not shown.

View 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

View File

@@ -71,6 +71,8 @@ case $PYVERSION in
[test_grammar.py]=1 # Too many stmts. Handle large stmts [test_grammar.py]=1 # Too many stmts. Handle large stmts
[test_io.py]=1 # Test takes too long to run [test_io.py]=1 # Test takes too long to run
[test_ioctl.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_memoryio.py]=1 # FIX
[test_multiprocessing.py]=1 # On uncompyle2, taks 24 secs [test_multiprocessing.py]=1 # On uncompyle2, taks 24 secs
[test_pep352.py]=1 # ? [test_pep352.py]=1 # ?

View File

@@ -170,7 +170,7 @@ class Python27Parser(Python2Parser):
""") """)
super(Python27Parser, self).customize_grammar_rules(tokens, customize) super(Python27Parser, self).customize_grammar_rules(tokens, customize)
self.check_reduce['and'] = 'AST' self.check_reduce['and'] = 'AST'
self.check_reduce['conditional_true'] = 'AST' # self.check_reduce['conditional_true'] = 'AST'
return return
def reduce_is_invalid(self, rule, ast, tokens, first, last): 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 jmp_target = jmp_false.offset + jmp_false.attr + 3
return not (jmp_target == tokens[last].offset or return not (jmp_target == tokens[last].offset or
tokens[last].pattr == jmp_false.pattr) tokens[last].pattr == jmp_false.pattr)
elif rule[0] == ('conditional_true'): # elif rule[0] == ('conditional_true'):
# FIXME: the below is a hack: we check expr for # # FIXME: the below is a hack: we check expr for
# nodes that could have possibly been a been a Boolean. # # nodes that could have possibly been a been a Boolean.
# We should also look for the presence of dead code. # # We should also look for the presence of dead code.
return ast[0] == 'expr' and ast[0] == 'or' # return ast[0] == 'expr' and ast[0] == 'or'
return False return False