diff --git a/test/bytecode_2.7/05_deadcode.pyc b/test/bytecode_2.7/05_deadcode.pyc new file mode 100644 index 00000000..278591ba Binary files /dev/null and b/test/bytecode_2.7/05_deadcode.pyc differ diff --git a/test/simple_source/bug27+/05_deadcode.py b/test/simple_source/bug27+/05_deadcode.py new file mode 100644 index 00000000..cfb3f4f7 --- /dev/null +++ b/test/simple_source/bug27+/05_deadcode.py @@ -0,0 +1,6 @@ +# Test to see we can a program that has dead code in it. +# This was issue #150 +def func(a): + if a: + return True + something_never_run() diff --git a/uncompyle6/parsers/parse2.py b/uncompyle6/parsers/parse2.py index 9e33fd84..17158857 100644 --- a/uncompyle6/parsers/parse2.py +++ b/uncompyle6/parsers/parse2.py @@ -505,7 +505,7 @@ class Python2Parser(PythonParser): self.check_reduce['aug_assign1'] = 'AST' self.check_reduce['aug_assign2'] = 'AST' - self.check_reduce['_stmts'] = 'AST' + # self.check_reduce['_stmts'] = 'AST' # Dead code testing... # self.check_reduce['while1elsestmt'] = 'tokens' @@ -522,15 +522,6 @@ class Python2Parser(PythonParser): if lhs in ('aug_assign1', 'aug_assign2') and ast[0] and ast[0][0] == 'and': return True - elif lhs == '_stmts': - for i, stmt in enumerate(ast): - if stmt == '_stmts': - stmt = stmt[0] - assert stmt == 'stmt' - if stmt[0] == 'return': - return i+1 != len(ast) - pass - return False return False class Python2ParserSingle(Python2Parser, PythonParserSingle):