3.x ifelsestmtc reduction rule fix

This commit is contained in:
rocky 2020-02-13 04:59:08 -05:00
parent dca2224520
commit 874d196e5c
13 changed files with 36 additions and 34 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,11 +1,13 @@
# 2.6.9 symbols.py
# Bug in 2.6 is having multple COME_FROMs due to the
# "and" in the "if" clause
# RUNNABLE
if __name__:
if __file__ and __name__:
pass
elif __name__:
pass
elif not __name__:
assert False
# 2.6.9 transformer.py
# Bug in 2.6 is multple COME_FROMs as a result
@ -21,3 +23,20 @@ elif __file__:
assert __name__ or __file__
else:
pass
# From 3.3.7 test_binop.py
# Bug was in ifelsestmt(c) ensuring b+=5 is not in "else"
# Also note: ifelsetmtc should not have been used since this
# this is not in a loop!
def __floordiv__(a, b):
if a:
b += 1
elif not b:
return a
b += 5
return b
assert __floordiv__(1, 1) == 7
assert __floordiv__(1, 0) == 6
assert __floordiv__(0, 3) == 8
assert __floordiv__(0, 0) == 0

View File

@ -1,13 +1,5 @@
SKIP_TESTS=(
[test_binop.py]=1 # FIXME: Works on c90ff51
[test_cgi.py]=1 # FIXME: Works on c90ff51
[test_buffer.py]=1 # FIXME: Works on c90ff51
[test_decorators.py]=1 # FIXME: Works on c90ff51
[test_optparse.py]=1 # FIXME: Works on c90ff51
[test_os.py]=1 # FIXME: Works on c90ff51
[test_pyclbr.py]=1 # FIXME: Works on c90ff51
[test_shutil.py]=1 # FIXME: Works on c90ff51
[test_strftime.py]=1 # FIXME: Works on c90ff51
[test_atexit.py]=1 # The atexit test starting at 3.3 looks for specific comments in error lines

View File

@ -1,9 +1,5 @@
SKIP_TESTS=(
[test_buffer.py]=1 # FIXME: Works on c90ff51
[test_decorators.py]=1 # FIXME: Works on c90ff51
[test_optparse.py]=1 # FIXME: Works on c90ff51
[test_os.py]=1 # FIXME: Works on c90ff51
[test_shutil.py]=1 # FIXME: Works on c90ff51
[test_strftime.py]=1 # FIXME: Works on c90ff51
[test___all__.py]=1 # it fails on its own

View File

@ -1,17 +1,5 @@
SKIP_TESTS=(
[test_buffer.py]=1 # FIXME: Works on c90ff51
[test_decorators.py]=1 # FIXME: Works on c90ff51
[test_ftplib.py]=1 # FIXME: Works on c90ff51
[test_optparse.py]=1 # FIXME: Works on c90ff51
[test_os.py]=1 # FIXME: Works on c90ff51
[test_poplib.py]=1 # FIXME: Works on c90ff51?
[test_platform.py]=1 # FIXME: Works on c90ff51
[test_pyclbr.py]=1 # FIXME: Works on c90ff51
[test_shutil.py]=1 # FIXME: Works on c90ff51?
[test_strftime.py]=1 # FIXME: Works on c90ff51?
[test_sysconfig.py]=1 # FIXME: Works on c90ff51?
[test_tempfile.py]=1 # FIXME: Works on c90ff51
[test_uu.py]=1 # FIXME: Works on c90ff51
[test___all__.py]=1 # it fails on its own
[test_aifc.py]=1 #

View File

@ -1,13 +1,11 @@
SKIP_TESTS=(
[test_ast.py]=1 # FIXME: Works on c90ff51
[test_binop.py]=1 # FIXME: Works on c90ff51
[test_complex.py]=1 # FIXME: Works on c90ff51
[test_format.py]=1 # FIXME: Works on c90ff51
[test_ftplib.py]=1 # FIXME: Works on c90ff51
[test_slice.py]=1 # FIXME: Works on c90ff51
[test_sort.py]=1 # FIXME: Works on c90ff51
[test_timeit.py]=1 # FIXME: Works on c90ff51
[test_os.py]=1 # FIXME: Works on c90ff51
[test_os.py]=1 # parse error FIXME: Works on c90ff51
[test___all__.py]=1 # it fails on its own
[test_aifc.py]=1 #

View File

@ -1,5 +1,4 @@
SKIP_TESTS=(
[test_builtin.py]=1 # FIXME works on decompyle6
[test_context.py]=1 # FIXME works on decompyle6
[test_doctest2.py]=1 # FIXME works on decompyle6
[test_format.py]=1 # FIXME works on decompyle6
@ -10,12 +9,11 @@ SKIP_TESTS=(
[test_slice.py]=1 # FIXME works on decompyle6
[test_sort.py]=1 # FIXME works on decompyle6
[test_statistics.py]=1 # FIXME works on decompyle6
[test_string_literals.py]=1 # FIXME works on decompyle6
[test_timeit.py]=1 # FIXME works on decompyle6
[test_urllib2_localnet.py]=1 # FIXME works on decompyle6
[test_urllib2.py]=1 # FIXME: works on uncompyle6
[test_generators.py]=1 # Investigate improper lamdba with bogus "False" added
[test_grammar.py]=1 # investigate: like above: semantic rule missing probably
[test_generators.py]=1 # FIXME: works on uncompyle6 - lambda parsing probably
[test_grammar.py]=1 # FIXME: works on uncompyle6 - lambda parsing probably
[test___all__.py]=1 # it fails on its own
[test_argparse.py]=1 #- it fails on its own

View File

@ -33,13 +33,23 @@ IFELSE_STMT_RULES = frozenset(
"else_suitec",
),
),
(
"ifelsestmtc",
(
"testexpr",
"c_stmts_opt",
"jump_forward_else",
"else_suitec",
"\\e__come_froms",
),
),
(
"ifelsestmtc",
(
"testexpr",
"c_stmts_opt",
"jump_absolute_else",
"else_suitec"
"else_suitec",
),
),
(
@ -94,6 +104,7 @@ def ifelsestmt(self, lhs, n, rule, ast, tokens, first, last):
return True
if rule not in IFELSE_STMT_RULES:
# print("XXX", rule)
return False
# Avoid if/else where the "then" is a "raise_stmt1" for an