3.6+ if/else in loops where jump offsets are "large"

This commit is contained in:
rocky
2020-01-15 04:43:53 -05:00
parent 5cdf057a47
commit 968f86011b
2 changed files with 29 additions and 24 deletions

View File

@@ -4,7 +4,7 @@ SKIP_TESTS=(
[test_asdl_parser.py]=1 # it fails on its own
[test_ast.py]=1 # Depends on comments in code
[test_atexit.py]=1 # The atexit test looks for specific comments in error lines
[test_baseexception.py]=1 #
[test_baseexception.py]=1 # UnboundLocalError: local variable 'exc' referenced before assignment
[test_bdb.py]=1 #
[test_buffer.py]=1 # parse error
[test_builtin.py]=1 # parser error
@@ -12,54 +12,48 @@ SKIP_TESTS=(
[test_cmath.py]=1 # test assertion failure
[test_cmd_line.py]=1 # Interactive?
[test_cmd_line_script.py]=1
[test_collections.py]=1
[test_compare.py]=1
[test_compare.py]=1 # Weird test assert faiure AssertionError: [1] == [1]
[test_compileall.py]=1 # fails on its own
[test_compile.py]=1
[test_compile.py]=1 # test assertion failures
[test_configparser.py]=1 # takes too long to run. Works on decompyle3 though I think.
[test_concurrent_futures.py]=1 # too long
[test_configparser.py]=1
[test_context.py]=1
[test_coroutines.py]=1 # Parse error
[test_codecs.py]=1
[test_crypt.py]=1 # Parse error
[test_codecs.py]=1 # test assert failures; encoding/decoding stuff
[test_ctypes.py]=1 # it fails on its own
[test_curses.py]=1 # Parse error
[test_curses.py]=1 # probably byte string not handled properly
[test_dataclasses.py]=1 # parse error
[test_datetime.py]=1 # Takes too long
[test_dbm_gnu.py]=1 # Takes too long
[test_dbm_ndbm.py]=1 # it fails on its own
[test_decimal.py]=1 # Parse error
[test_descr.py]=1 # Parse error
[test_descr.py]=1 # Investigate. Invalid syntax: self.assertEqual(1.__bool__(), 1)
[test_devpoll.py]=1 # it fails on its own
[test_dis.py]=1 # We change line numbers - duh!
[test_doctest2.py]=1 # assert failure
[test_docxmlrpc.py]=1
[test_enum.py]=1 # probably bad control flow
[test_exceptions.py]=1 # parse error
[test_enumerate.py]=1 #
[test_enum.py]=1 #
[test_faulthandler.py]=1 # takes too long
[test_fcntl.py]=1
[test_fileinput.py]=1
[test_float.py]=1
[test_format.py]=1
[test_float.py]=1 # Investigate: AssertionError: inf not identical to inf
[test_format.py]=1 # Probalby not handling bytestrings properly
[test_frame.py]=1
[test_ftplib.py]=1
[test_functools.py]=1
[test_functools.py]=1 # parser error
[test_gdb.py]=1 # it fails on its own
[test_generators.py]=1 # improper decompile of assert i < n and (n-i) % 3 == 0
[test_glob.py]=1 #
[test_glob.py]=1 # TypeError: join() argument must be str or bytes, not 'tuple'
[test_grammar.py]=1
[test_grp.py]=1 # Doesn't terminate (killed)
[test_gzip.py]=1 # parse error
[test_hashlib.py]=1 # test assert failures
[test_http_cookiejar.py]=1
[test_httplib.py]=1 # parse error
[test_imaplib-3.7.py]=1
[test_idle.py]=1 # Probably installation specific
[test_io.py]=1 # test takes too long to run: 37 seconds
[test_imaplib.py]=1
[test_index.py]=1
[test_inspect.py]=1
[test_index.py]=1 # parse error
[test_inspect.py]=1 # test failures
[test_itertools.py]=1 # parse error
[test_keywordonlyarg.py]=1 # Investigate: parameter handling
[test_kqueue.py]=1 # it fails on its own
@@ -79,11 +73,9 @@ SKIP_TESTS=(
[test_optparse.py]=1 # doesn't terminate (killed)
[test_os.py]=1 # probably control flow (uninitialized variable)
[test_ossaudiodev.py]=1 # it fails on its own
[test_pathlib.py]=1 # parse error
[test_pdb.py]=1 # Probably relies on comments
[test_peepholer.py]=1 # test assert error
[test_pickle.py]=1 # Probably relies on comments
[test_plistlib.py]=1 # Investigate "strings can't contains control characters; "
[test_poll.py]=1
[test_poplib.py]=1
[test_pydoc.py]=1 # it fails on its own
@@ -117,7 +109,7 @@ SKIP_TESTS=(
[test_subprocess.py]=1
[test_sys_setprofile.py]=1 # test assertions failed
[test_sys_settrace.py]=1 # parse error
[test_tarfile.py]=1 # parse error
[test_tarfile.py]=1 # test assertions failed
[test_threading.py]=1 #
[test_timeit.py]=1 # probably control flow uninitialized variable
[test_tk.py]=1 # test takes too long to run: 13 seconds

View File

@@ -969,9 +969,22 @@ class Python37Parser(Python37BaseParser):
stmt ::= whileTruestmt
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite _come_froms
ifstmtl ::= testexpr _ifstmts_jumpl
_ifstmts_jumpl ::= c_stmts JUMP_BACK
_ifstmts_jumpl ::= _ifstmts_jump
ifstmtl ::= testexpr _ifstmts_jumpl
# The following can happen when the jump offset is large and
# Python is looking to do a small jump to a larger jump to get
# around the problem that the offset can't be represented in
# the size allowed for the jump offset. This is more likely to
# happen in wordcode Python since the offset range has been
# reduced. FIXME: We should add a reduction check that the
# final jump goes to another jump.
_ifstmts_jumpl ::= COME_FROM c_stmts JUMP_BACK
_ifstmts_jumpl ::= COME_FROM c_stmts JUMP_FORWARD
"""
def p_loop_stmt3(self, args):