diff --git a/test/Makefile b/test/Makefile index 15fc94f9..06637d2c 100644 --- a/test/Makefile +++ b/test/Makefile @@ -116,6 +116,11 @@ grammar-coverage-2.7: SPARK_PARSER_COVERAGE=/tmp/spark-grammar-27.cover $(PYTHON) test_pythonlib.py --bytecode-2.7 SPARK_PARSER_COVERAGE=/tmp/spark-grammar-27.cover $(PYTHON) test_pyenvlib.py --2.7.13 +#: Get grammar coverage for Python 3.4 +grammar-coverage-3.4: + SPARK_PARSER_COVERAGE=/tmp/spark-grammar-34.cover $(PYTHON) test_pythonlib.py --bytecode-3.4 + SPARK_PARSER_COVERAGE=/tmp/spark-grammar-34.cover $(PYTHON) test_pyenvlib.py --3.4.2 + #: Check deparsing Python 2.6 check-bytecode-2.6: $(PYTHON) test_pythonlib.py --bytecode-2.6 --weak-verify diff --git a/test/bytecode_2.6/10_del.pyc b/test/bytecode_2.6/10_del.pyc index 68414033..1be07946 100644 Binary files a/test/bytecode_2.6/10_del.pyc and b/test/bytecode_2.6/10_del.pyc differ diff --git a/test/bytecode_3.4/10_del.pyc b/test/bytecode_3.4/10_del.pyc index 8da488ef..1aa477c0 100644 Binary files a/test/bytecode_3.4/10_del.pyc and b/test/bytecode_3.4/10_del.pyc differ diff --git a/test/bytecode_3.5/10_del.pyc b/test/bytecode_3.5/10_del.pyc index 714d7d16..4bf9719f 100644 Binary files a/test/bytecode_3.5/10_del.pyc and b/test/bytecode_3.5/10_del.pyc differ diff --git a/test/simple_source/stmts/10_del.py b/test/simple_source/stmts/10_del.py index e1af6772..65d1aa3a 100644 --- a/test/simple_source/stmts/10_del.py +++ b/test/simple_source/stmts/10_del.py @@ -11,3 +11,8 @@ del c[2:3] d = [0,1,2,3,4,5,6] del d[1:3:2] + +e = ('a', 'b') +def foo(): + global e + del e diff --git a/test/test_pyenvlib.py b/test/test_pyenvlib.py index 6ace979a..35061f07 100755 --- a/test/test_pyenvlib.py +++ b/test/test_pyenvlib.py @@ -30,10 +30,11 @@ from fnmatch import fnmatch TEST_VERSIONS=('2.3.7', '2.4.6', '2.5.6', '2.6.9', 'pypy-2.4.0', 'pypy-2.6.1', 'pypy-5.0.1', 'pypy-5.3.1', 'pypy3.5-5.7.1-beta', - '2.7.10', '2.7.11', '2.7.12', '2.7.13', + '2.7.10', '2.7.11', '2.7.12', '2.7.13', '2.7.14', '3.0.1', '3.1.5', '3.2.6', '3.3.5', '3.3.6', - '3.4.2', '3.5.1', '3.6.0', 'native') + '3.4.2', '3.5.1', '3.5.2', '3.6.0', '3.6.3', + 'native') target_base = '/tmp/py-dis/' lib_prefix = os.path.join(os.environ['HOME'], '.pyenv/versions') diff --git a/uncompyle6/parsers/parse26.py b/uncompyle6/parsers/parse26.py index 85449528..3015f197 100644 --- a/uncompyle6/parsers/parse26.py +++ b/uncompyle6/parsers/parse26.py @@ -263,6 +263,11 @@ class Python26Parser(Python2Parser): if invalid: return invalid if rule == ('and', ('expr', 'jmp_false', 'expr', '\\e_come_from_opt')): + + # FIXME: workaround profiling bug + if ast[1] is None: + return False + # Test that jmp_false jumps to the end of "and" # or that it jumps to the same place as the end of "and" jmp_false = ast[1][0] diff --git a/uncompyle6/semantics/check_ast.py b/uncompyle6/semantics/check_ast.py index f2b42bde..417232d1 100644 --- a/uncompyle6/semantics/check_ast.py +++ b/uncompyle6/semantics/check_ast.py @@ -9,6 +9,8 @@ before reduction and don't reduce when there is a problem. """ def checker(ast, in_loop, errors): + if ast is None: + return in_loop = in_loop or ast.kind in ('while1stmt', 'whileTruestmt', 'whilestmt', 'whileelsestmt', 'while1elsestmt', 'for_block') diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 4f4559a6..d29f671c 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -2239,6 +2239,10 @@ def deparse_code(version, co, out=sys.stdout, showasm=None, showast=False, isTopLevel = co.co_name == '' deparsed.ast = deparsed.build_ast(tokens, customize, isTopLevel=isTopLevel) + #### XXX workaround for profiling + if deparsed.ast is None: + return None + assert deparsed.ast == 'stmts', 'Should have parsed grammar start' del tokens # save memory