diff --git a/test/stdlib/2.5-exclude.sh b/test/stdlib/2.5-exclude.sh index e2f2b2e2..dc08ccb1 100644 --- a/test/stdlib/2.5-exclude.sh +++ b/test/stdlib/2.5-exclude.sh @@ -59,7 +59,6 @@ SKIP_TESTS=( [test_pwd.py]=1 # Long test - might work? Control flow? [test_pyclbr.py]=1 # Investigate [test_rgbimg.py]=1 # it fails on its own - [test_queue.py]=1 # Control flow? [test_scriptpackages.py]=1 # it fails on its own [test_socketserver.py]=1 # Too long to run - 42 seconds [test_sqlite.py]=1 # it fails on its own diff --git a/test/stdlib/2.7-exclude.sh b/test/stdlib/2.7-exclude.sh index e189743f..296cd679 100644 --- a/test/stdlib/2.7-exclude.sh +++ b/test/stdlib/2.7-exclude.sh @@ -19,7 +19,6 @@ SKIP_TESTS=( [test_modulefinder.py]=1 # FIX [test_multiprocessing.py]=1 # On uncompyle2, takes 24 secs [test_poll.py]=1 # test takes too long to run: 11 seconds - [test_pwd.py]=1 # Takes too long [test_regrtest.py]=1 # [test_runpy.py]=1 # Long and fails on its own [test_select.py]=1 # Runs okay but takes 11 seconds diff --git a/uncompyle6/parsers/parse26.py b/uncompyle6/parsers/parse26.py index 51941c22..abacd8bc 100644 --- a/uncompyle6/parsers/parse26.py +++ b/uncompyle6/parsers/parse26.py @@ -6,6 +6,9 @@ spark grammar differences over Python2 for Python 2.6. from uncompyle6.parser import PythonParserSingle from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG from uncompyle6.parsers.parse2 import Python2Parser +from uncompyle6.parsers.reducecheck import ( + except_handler, +) class Python26Parser(Python2Parser): @@ -345,6 +348,11 @@ class Python26Parser(Python2Parser): WITH_CLEANUP END_FINALLY """) super(Python26Parser, self).customize_grammar_rules(tokens, customize) + self.reduce_check_table = { + "except_handler": except_handler, + } + + self.check_reduce['and'] = 'AST' self.check_reduce['assert_expr_and'] = 'AST' self.check_reduce["ifstmt"] = "tokens" diff --git a/uncompyle6/parsers/parse27.py b/uncompyle6/parsers/parse27.py index cca41153..02b0b743 100644 --- a/uncompyle6/parsers/parse27.py +++ b/uncompyle6/parsers/parse27.py @@ -9,6 +9,7 @@ from uncompyle6.parsers.parse2 import Python2Parser from uncompyle6.parsers.reducecheck import ( or_check, tryelsestmt, + except_handler, ) class Python27Parser(Python2Parser): @@ -230,6 +231,7 @@ class Python27Parser(Python2Parser): # FIXME: Put more in this table self.reduce_check_table = { # "ifelsestmt": ifelsestmt, + "except_handler": except_handler, "or": or_check, "tryelsestmt": tryelsestmt, "tryelsestmtl": tryelsestmt, diff --git a/uncompyle6/parsers/reducecheck/__init__.py b/uncompyle6/parsers/reducecheck/__init__.py index 0ab057ae..e7eafa3f 100644 --- a/uncompyle6/parsers/reducecheck/__init__.py +++ b/uncompyle6/parsers/reducecheck/__init__.py @@ -1,4 +1,5 @@ from uncompyle6.parsers.reducecheck.and_check import * +from uncompyle6.parsers.reducecheck.except_handler import * from uncompyle6.parsers.reducecheck.except_handler_else import * from uncompyle6.parsers.reducecheck.ifelsestmt import * from uncompyle6.parsers.reducecheck.iflaststmt import * diff --git a/uncompyle6/parsers/reducecheck/except_handler.py b/uncompyle6/parsers/reducecheck/except_handler.py new file mode 100644 index 00000000..367a970a --- /dev/null +++ b/uncompyle6/parsers/reducecheck/except_handler.py @@ -0,0 +1,12 @@ +# Copyright (c) 2020 Rocky Bernstein + +def except_handler(self, lhs, n, rule, ast, tokens, first, last): + end_token = tokens[last-1] + # for t in range(first, last): + # print(tokens[t]) + # print("=" * 30) + + # Make sure come froms all come from within "except_handler". + if end_token != "COME_FROM": + return False + return end_token.attr < tokens[first].offset