Better "ifstmt" reduction rule and ...

Tidy 3.7 grammar a little
Disable a number of 3.0 bytecode for now. Will Go over later.
This commit is contained in:
rocky
2020-01-24 21:34:27 -05:00
parent c90ff5176c
commit 13b1ec7ad8
10 changed files with 37 additions and 88 deletions

View File

@@ -23,29 +23,19 @@ SKIP_TESTS=(
[test_peepholer.py]=1
[test_poll.py]=1 # test takes too long to run: 11 seconds
[test_queue.py]=1
[test_raise.py]=1 # test assertion errors
[test_re.py]=1
[test_resource.py]=1
[test_runpy.py]=1
[test_scope.py]=1
[test_select.py]=1
[test_set.py]=1
[test_signal.py]=1
[test_socket.py]=1
[test_ssl.py]=1 # too installation specific
[test_strlit.py]=1
[test_subprocess.py]=1 # test takes too long to run: 28 seconds
[test_symtable.py]=1
[test_sys_setprofile.py]=1 # test assertion errors
[test_sys_settrace.py]=1
[test_thread.py]=1
[test_timeout.py]=1
[test_traceback.py]=1
[test_urllib2.py]=1
[test_warnings.py]=1
[test_zipfile.py]=1 # too long - 12 second
[test_zipfile64.py]=1
[test_zipimport.py]=1
[test_zipimport_support.py]=1
[test_sys_settrace.py]=1 # test assertion errors
[test_timeout.py]=1 # Too long to run: 19 seconds
[test_traceback.py]=1 # Probably introspects code
[test_zipfile64.py]=1 # Too long to run
)
# About 300 unit-test files in about 20 minutes

View File

@@ -1,12 +1,7 @@
SKIP_TESTS=(
[test___all__.py]=1 # it fails on its own
[test_aifc.py]=1 #
[test_asynchat.py]=1 #
[test_asyncore.py]=1 #
[test_atexit.py]=1 # The atexit test looks for specific comments in error lines
[test_bdb.py]=1 #
[test_buffer.py]=1 # parse error
[test_cmd_line.py]=1
[test_cmd_line.py]=1 # takes too long to run
[test_concurrent_futures.py]=1 # too long?
[test_configparser.py]=1 # Doesn't terminate
[test_ctypes.py]=1 # it fails on its own
@@ -14,88 +9,53 @@ SKIP_TESTS=(
[test_dbm_gnu.py]=1 # fails on its own
[test_devpoll.py]=1 # it fails on its own
[test_descr.py]=1 # test assertion errors
[test_dict.py]=1 #
[test_dis.py]=1 # We change line numbers - duh!
[test_distutils.py]=1 # it fails on its own
[test_doctest2.py]=1
[test_doctest.py]=1
[test_doctest.py]=1 # test assert failures
[test_docxmlrpc.py]=1
[test_enum.py]=1
[test_enum.py]=1 # compile syntax?
[test_exceptions.py]=1
[test_faulthandler.py]=1
[test_file_eintr.py]=1 # parse error
[test_fork1.py]=1 # too long
[test_gdb.py]=1 # it fails on its own
[test_grammar.py]=1
[test_generators.py]=1 # test assert failures
[test_grp.py]=1 # Long test
[test_heapq.py]=1
[test_httpservers.py]=1
[test_httplib.py]=1 # it fails on its ow
[test_grammar.py]=1 # parse error
[test_httplib.py]=1 # it fails on its own
[test_import.py]=1 # it fails on its own
[test_io.py]=1
[test_ioctl.py]=1 # it fails on its own
[test_inspect.py]=1 # Syntax error Investigate
[test_itertools.py]=1 # doesn't terminate on test_permutations
[test_logging.py]=1 #
[test_long.py]=1 #
[test_marshal.py]=1 #
[test_math.py]=1 #
[test_mmap.py]=1
[test_logging.py]=1 # Too long to run
[test_modulefinder.py]=1 # test assertion error
[test_multiprocessing_fork.py]=1 # doesn't terminate
[test_multiprocessing_forkserver.py]=1 # doesn't terminate
[test_multiprocessing_main_handling.py]=1 # doesn't terminate
[test_multiprocessing_spawn.py]=1 # doesn't terminate
[test_nntplib.py]=1 # doesn't terminate#
[test_ordered_dict.py]=1
[test_peepholer.py]=1
[test_pep352.py]=1
[test_pep380.py]=1
[test_pickle.py]=1
[test_nntplib.py]=1 # too long to run
[test_peepholer.py]=1 # control flow?
[test_pep352.py]=1 # test assert failures
[test_pickle.py]=1 # test assert failures
[test_pkgimport.py]=1 # long
[test_poll.py]=1
[test_poplib.py]=1
[test_pwd.py]=1 # Takes too long
[test_pydoc.py]=1
[test_queue.py]=1
[test_raise.py]=1
[test_re.py]=1
[test_resource.py]=1
[test_runpy.py]=1
[test_sched.py]=1
[test_scope.py]=1
[test_select.py]=1 # Too long 11 seconds
[test_selectors.py]=1 # Too long; 11 seconds
[test_set.py]=1
[test_shlex.py]=1
[test_shutil.py]=1
[test_signal.py]=1
[test_smtplib.py]=1
[test_poll.py]=1 # Too long to run: 11 seconds
[test_pydoc.py]=1 # test assertion failures
[test_runpy.py]=1 # Too long:
[test_select.py]=1 # Too long: 11 seconds
[test_selectors.py]=1 # Too long: 11 seconds
[test_signal.py]=1 # Too long: 22 seconds
[test_sndhdr.py]=1
[test_socket.py]=1 # long 25 seconds
[test_socketserver.py]=1 # long 25 seconds
[test_struct.py]=1 # Doesn't terminate
[test_strlit.py]=1 # test failure
[test_subprocess.py]=1 # Too long
[test_symtable.py]=1 # Investigate bad output
[test_sys_settrace.py]=1 # test assert failures
[test_sys_setprofile.py]=1
[test_tcl.py]=1 # May be implementation specific. On POWER though it fails
[test_telnetlib.py]=1 # Doesn't terminate
[test_thread.py]=1
[test_threading.py]=1 # Too long
[test_threadsignals.py]=1
[test_timeout.py]=1
[test_traceback.py]=1 # test failure
[test_tracemalloc.py]=1
[test_urllib2.py]=1 # test assertion failure
[test_threadsignals.py]=1 # Too long to run: 12 seconds
[test_timeout.py]=1 # Too long to run: 19 seconds
[test_traceback.py]=1 # introspects on code
[test_urllib2net.py]=1 # Doesn't terminate
[test_warnings.py]=1
[test_zipfile.py]=1 # too long
[test_zipfile64.py]=1
[test_zipimport.py]=1
[test_zipimport_support.py]=1
[test_zlib.py]=1
)
# 272 unit-test file in about 15 minutes

View File

@@ -40,7 +40,6 @@ SKIP_TESTS=(
[test_grp.py]=1 # Long test
[test_heapq.py]=1 # test assertion failures
[test_httpservers.py]=1 # test assertion errors
[test_imaplib.py]=1
[test_inspect.py]=1 # Syntax error Investigate
@@ -91,7 +90,6 @@ SKIP_TESTS=(
[test_sys_settrace.py]=1 # test assert fail
[test_tcl.py]=1 # it fails on its own
[test_tempfile.py]=1 # FIXME nested "if" is in wrong place. 3.6.2. may work though
[test_thread.py]=1
[test_threading.py]=1
[test_timeout.py]=1
@@ -107,7 +105,6 @@ SKIP_TESTS=(
[test_urllib2net.py]=1 # it fails on its own
[test_urllibnet.py]=1 # it fails on its own
[test_urlparse.py]=1 # test assert error
[test_uu.py]=1 # May 3.6.2. may work
[test_winreg.py]=1 # it fails on its own
[test_winsound.py]=1 # it fails on its own

View File

@@ -12,7 +12,6 @@ SKIP_TESTS=(
[test_buffer.py]=1 # parse error
[test_builtin.py]=1 # Fails on its own
[test test_capi.py]=1 # it fails on its own
[test_cmath.py]=1 # Investigate weird if control flow
[test_cmd_line.py]=1 # Interactive?
[test_codecencodings_cn.py]=1 # it fails on its own
@@ -30,7 +29,6 @@ SKIP_TESTS=(
[test_collections.py]= # it fails on its own
[test_compile.py]=1 # Code introspects on co_consts in a non-decompilable way
[test_concurrent_futures.py]=1 # Takes long
[test_contains.py]=1 # Code "while False: yield None" is optimized away in compilation
[test_contextlib.py]=1 # test assertion failure
[test_contextlib_async.py]=1 # Investigate
[test_coroutines.py]=1 # Parse error
@@ -62,7 +60,7 @@ SKIP_TESTS=(
[test___future__.py]=1 # syntax error: Investigate
[test_gdb.py]=1 # it fails on its own
[test_generators.py]=1 # test assert failures
[test_generators.py]=1 # FIXME: Invalid syntax: f2 = lambda : (yield from g()) if False:
[test_genexps.py]=1 #
[test_glob.py]=1 #
[test_grammar.py]=1 # parse error
@@ -73,7 +71,7 @@ SKIP_TESTS=(
[test_io.py]=1 # it fails on its own
[test_imaplib.py]=1
[test_inspect.py]=1 # Syntax error Investigate
[test_itertools.py]=1 #
[test_itertools.py]=1 # test assertion failures
[test_kqueue.py]=1 # it fails on its own
@@ -143,9 +141,8 @@ SKIP_TESTS=(
[test_sys.py]=1 # Investigate confusing "and" with nested "if" when there is an "else
[test_sys_settrace.py]=1 # parse error
[test_tarfile.py]=1 # it fails on its own
[test_tcl.py]=1 # FIXME parse error. Release 3.6.2 may work though
[test_tcl.py]=1 # Test assert failures
[test_telnetlib.py]=1 # takes more than 15 seconds to run
[test_tempfile.py]=1 # FIXME nested "if" is in wrong place. 3.6.2. may work though
[test_thread.py]=1 # it fails on its own
[test_threading.py]=1
[test_threadsignals.py]=1

View File

@@ -31,6 +31,7 @@ from uncompyle6.scanners.tok import Token
from uncompyle6.parser import PythonParser, PythonParserSingle, nop_func
from uncompyle6.parsers.reducecheck import (
except_handler_else,
ifstmt,
# iflaststmt,
testtrue,
tryelsestmtl3,
@@ -1535,6 +1536,11 @@ class Python3Parser(PythonParser):
# elif lhs == "iflaststmtl":
# return iflaststmt(self, lhs, n, rule, ast, tokens, first, last)
elif rule == ("ifstmt", ("testexpr", "_ifstmts_jump")):
if self.version <= 3.0:
return False
if ifstmt(self, lhs, n, rule, ast, tokens, first, last):
return True
# FIXME: do we need the below or is it covered by "ifstmt" above?
condition_jump = ast[0].last_child()
if condition_jump.kind.startswith("POP_JUMP_IF"):
condition_jump2 = tokens[min(last - 1, len(tokens) - 1)]

View File

@@ -853,13 +853,12 @@ class Python37Parser(Python37BaseParser):
except_handler ::= JUMP_FORWARD COME_FROM except_stmts
come_froms END_FINALLY come_from_opt
except_stmts ::= except_stmts except_stmt
except_stmts ::= except_stmt
except_stmts ::= except_stmt+
except_stmt ::= except_cond1 except_suite come_from_opt
except_stmt ::= except_cond2 except_suite come_from_opt
except_stmt ::= except_cond2 except_suite_finalize
except_stmt ::= except
except_stmt ::= except_cond1 except_suite come_from_opt
except_stmt ::= except_cond2 except_suite come_from_opt
except_stmt ::= except_cond2 except_suite_finalize
except_stmt ::= except
## FIXME: what's except_pop_except?
except_stmt ::= except_pop_except