Merge branch 'master' into python-2.4

This commit is contained in:
rocky
2017-12-02 13:23:07 -05:00
13 changed files with 38 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -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]

View File

@@ -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]

View File

@@ -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!

View File

@@ -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':

View File

@@ -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))

View File

@@ -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):

View File

@@ -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),