diff --git a/test/bytecode_2.6/01_ops.pyc b/test/bytecode_2.6/01_ops.pyc index 440eccd7..1405164d 100644 Binary files a/test/bytecode_2.6/01_ops.pyc and b/test/bytecode_2.6/01_ops.pyc differ diff --git a/test/bytecode_2.7/01_ops.pyc b/test/bytecode_2.7/01_ops.pyc index 02833415..9da72d5d 100644 Binary files a/test/bytecode_2.7/01_ops.pyc and b/test/bytecode_2.7/01_ops.pyc differ diff --git a/test/bytecode_3.1/01_ops.pyc b/test/bytecode_3.1/01_ops.pyc deleted file mode 100644 index 12d44468..00000000 Binary files a/test/bytecode_3.1/01_ops.pyc and /dev/null differ diff --git a/test/bytecode_3.2/01_ops.pyc b/test/bytecode_3.2/01_ops.pyc deleted file mode 100644 index 39137bd7..00000000 Binary files a/test/bytecode_3.2/01_ops.pyc and /dev/null differ diff --git a/test/bytecode_3.3/01_ops.pyc b/test/bytecode_3.3/01_ops.pyc index 14eea45d..c2419040 100644 Binary files a/test/bytecode_3.3/01_ops.pyc and b/test/bytecode_3.3/01_ops.pyc differ diff --git a/test/bytecode_3.4/01_ops.pyc b/test/bytecode_3.4/01_ops.pyc new file mode 100644 index 00000000..2692cde8 Binary files /dev/null and b/test/bytecode_3.4/01_ops.pyc differ diff --git a/test/simple_source/bug22/01_ops.py b/test/simple_source/bug22/01_ops.py index 18efd99e..31603ba4 100644 --- a/test/simple_source/bug22/01_ops.py +++ b/test/simple_source/bug22/01_ops.py @@ -16,3 +16,6 @@ y ^= 1 # INPLACE_XOR x = [1,2,3,4,5] x[0:1] = 1 x[0:3] += 1, 2, 3 + +# Is not in chained compare +x[0] is not x[1] is not x[2] diff --git a/test/simple_source/bug30/01_ops.py b/test/simple_source/bug30/01_ops.py index 9dfb189b..c984b3dd 100644 --- a/test/simple_source/bug30/01_ops.py +++ b/test/simple_source/bug30/01_ops.py @@ -17,3 +17,6 @@ y ^= 1 # INPLACE_XOR x = [1,2,3,4,5] x[0:1] = 1 x[0:3] += 1, 2, 3 + +# Is not in chained compare +x[0] is not x[1] is not x[2] diff --git a/test/stdlib/runtests.sh b/test/stdlib/runtests.sh index e159ccbb..d27bd02e 100755 --- a/test/stdlib/runtests.sh +++ b/test/stdlib/runtests.sh @@ -7,7 +7,25 @@ PYVERSION=${FULLVERSION%.*} MINOR=${FULLVERSION##?.?.} typeset -i STOP_ONERROR=1 -typeset -A SKIP_TESTS=( [test_aepack.py]=1 [audiotests.py]=1) + +typeset -A SKIP_TESTS +case $PYVERSION in + 2.6) + SKIP_TESTS=( [test_array.py]=1 [test_asyncore.py]=1) + ;; + 2.7) + SKIP_TESTS=( + [test_builtin.py]=1 + [test_contextlib.py]=1 # decorators + [test_decorators.py]=1 # decorators + [test_decimal.py]=1 + [test_descr.py]=1 # syntax error look at + ) + ;; + *) + SKIP_TESTS=( [test_aepack.py]=1 [audiotests.py]=1) + ;; +esac # Test directory setup srcdir=$(dirname $me) @@ -25,7 +43,13 @@ export PYTHONPATH=$TESTDIR # Run tests typeset -i i=0 typeset -i allerrs=0 -for file in test_*.py; do +if [[ -n $1 ]] ; then + files=$1 + SKIP_TESTS=() +else + files=test_*.py +fi +for file in $files; do [[ -v SKIP_TESTS[$file] ]] && continue # If the fails *before* decompiling, skip it! diff --git a/uncompyle6/parsers/parse2.py b/uncompyle6/parsers/parse2.py index e38b8cf9..aa0eb181 100644 --- a/uncompyle6/parsers/parse2.py +++ b/uncompyle6/parsers/parse2.py @@ -80,8 +80,6 @@ class Python2Parser(PythonParser): raise_stmt2 ::= expr expr RAISE_VARARGS_2 raise_stmt3 ::= expr expr expr RAISE_VARARGS_3 - stmt ::= exec_stmt - del_stmt ::= expr DELETE_SLICE+0 del_stmt ::= expr expr DELETE_SLICE+2 del_stmt ::= expr expr expr DELETE_SLICE+3 @@ -334,9 +332,10 @@ class Python2Parser(PythonParser): continue elif opname == 'EXEC_STMT': self.addRule(""" - exprlist ::= expr+ + stmt ::= exec_stmt exec_stmt ::= expr exprlist DUP_TOP EXEC_STMT exec_stmt ::= expr exprlist EXEC_STMT + exprlist ::= expr+ """, nop_func) continue elif opname == 'JUMP_IF_NOT_DEBUG': diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 70022d7e..7880ae62 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -903,6 +903,7 @@ class Python3Parser(PythonParser): j = 1 else: j = 2 + if has_get_iter_call_function1: rule_pat = ("generator_exp ::= %sload_genexpr %%s%s expr " "GET_ITER CALL_FUNCTION_1" % ('pos_arg '* args_pos, opname)) diff --git a/uncompyle6/scanners/scanner2.py b/uncompyle6/scanners/scanner2.py index 9d366f06..bf9c128d 100644 --- a/uncompyle6/scanners/scanner2.py +++ b/uncompyle6/scanners/scanner2.py @@ -1045,15 +1045,10 @@ class Scanner2(Scanner): # or: # RETURN_VALUE POP_TOP .. POP_TOP END_FINALLY skip_come_from = False - if self.version <= 2.5: + if self.version <= 2.6: skip_come_from = (code[offset+3] == self.opc.END_FINALLY or (code[offset+3] == self.opc.POP_TOP and code[offset+4] == self.opc.END_FINALLY)) - else: - skip_come_from = (code[offset+3] == self.opc.END_FINALLY or - (op != self.opc.JUMP_FORWARD - and code[offset+3] == self.opc.POP_TOP - and code[offset+4] == self.opc.END_FINALLY)) if not skip_come_from: # FIXME: rocky: I think we need something like this... if offset not in set(self.ignore_if): diff --git a/uncompyle6/semantics/consts.py b/uncompyle6/semantics/consts.py index 93b5587b..70f67015 100644 --- a/uncompyle6/semantics/consts.py +++ b/uncompyle6/semantics/consts.py @@ -193,8 +193,8 @@ TABLE_DIRECT = { 'compare_single': ( '%p %[-1]{pattr.replace("-", " ")} %p', (0, 19), (1, 19) ), 'compare_chained': ( '%p %p', (0, 29), (1, 30)), - 'compare_chained1': ( '%[3]{pattr} %p %p', (0, 19), (-2, 19)), - 'compare_chained2': ( '%[1]{pattr} %p', (0, 19)), + 'compare_chained1': ( '%[3]{pattr.replace("-", " ")} %p %p', (0, 19), (-2, 19)), + 'compare_chained2': ( '%[1]{pattr.replace("-", " ")} %p', (0, 19)), # 'classdef': (), # handled by n_classdef() 'function_def': ( '\n\n%|def %c\n', -2), # -2 to handle closures 'funcdefdeco': ( '\n\n%c', 0),