diff --git a/test/bytecode_2.7/03_double_equals.pyc b/test/bytecode_2.7/03_double_equals.pyc new file mode 100644 index 00000000..6d75df36 Binary files /dev/null and b/test/bytecode_2.7/03_double_equals.pyc differ diff --git a/test/simple_source/bug26/03_double_equals.py b/test/simple_source/bug26/03_double_equals.py new file mode 100644 index 00000000..f757ee29 --- /dev/null +++ b/test/simple_source/bug26/03_double_equals.py @@ -0,0 +1,6 @@ +# From Python 2.7 parse_starttag HTMLParser.pyc +attrvalue = [1,2] +while attrvalue: + if attrvalue[:1] == 5 or \ + attrvalue[:1] == 2 == attrvalue[-1:]: + attrvalue = 10 diff --git a/uncompyle6/semantics/consts.py b/uncompyle6/semantics/consts.py index 46b21037..ee233ae3 100644 --- a/uncompyle6/semantics/consts.py +++ b/uncompyle6/semantics/consts.py @@ -176,7 +176,7 @@ TABLE_DIRECT = { 'conditional_lambda': ( '(%c if %c else %c)', 2, 0, 3), 'return_lambda': ('%c', 0), 'compare': ( '%p %[-1]{pattr} %p', (0, 19), (1, 19) ), - 'cmp_list': ( '%p %p', (0, 20), (1, 19)), + 'cmp_list': ( '%p %p', (0, 29), (1, 30)), 'cmp_list1': ( '%[3]{pattr} %p %p', (0, 19), (-2, 19)), 'cmp_list2': ( '%[1]{pattr} %p', (0, 19)), # 'classdef': (), # handled by n_classdef() @@ -274,6 +274,10 @@ MAP = { 'exprlist': MAP_R0, } +# Operator precidence +# See https://docs.python.org/3/reference/expressions.html +# or https://docs.python.org/3/reference/expressions.html +# for a list. PRECEDENCE = { 'build_list': 0, 'mapexpr': 0,