diff --git a/test/bytecode_3.2_run/04_call_function.pyc b/test/bytecode_3.2_run/04_call_function.pyc index aceb8c1d..662d6d43 100644 Binary files a/test/bytecode_3.2_run/04_call_function.pyc and b/test/bytecode_3.2_run/04_call_function.pyc differ diff --git a/test/bytecode_3.5_run/04_call_function.pyc b/test/bytecode_3.5_run/04_call_function.pyc index 5e2ef8e8..942b70a0 100644 Binary files a/test/bytecode_3.5_run/04_call_function.pyc and b/test/bytecode_3.5_run/04_call_function.pyc differ diff --git a/test/bytecode_3.6_run/04_call_function.pyc b/test/bytecode_3.6_run/04_call_function.pyc index ae64294d..a11bdced 100644 Binary files a/test/bytecode_3.6_run/04_call_function.pyc and b/test/bytecode_3.6_run/04_call_function.pyc differ diff --git a/test/bytecode_3.7_run/04_call_function.pyc b/test/bytecode_3.7_run/04_call_function.pyc new file mode 100644 index 00000000..cf21a240 Binary files /dev/null and b/test/bytecode_3.7_run/04_call_function.pyc differ diff --git a/test/simple_source/bug35/04_call_function.py b/test/simple_source/bug35/04_call_function.py index 9a41deef..7fad3438 100644 --- a/test/simple_source/bug35/04_call_function.py +++ b/test/simple_source/bug35/04_call_function.py @@ -79,3 +79,7 @@ class ResultMixin(object): class SplitResult(namedtuple('SplitResult', 'scheme netloc path query fragment'), ResultMixin): pass + +# From 3.3.7 test_long.py +# Bug was that we need parens around first "0" +assert (0).bit_length() == 0 diff --git a/uncompyle6/semantics/customize37.py b/uncompyle6/semantics/customize37.py index 3ec60c0c..bf5ba35e 100644 --- a/uncompyle6/semantics/customize37.py +++ b/uncompyle6/semantics/customize37.py @@ -81,7 +81,7 @@ def customize_for_version37(self, version): (17, "for_block"), (25, "else_suite"), ), - "attribute37": ("%c.%[1]{pattr}", 0), + "attribute37": ("%c.%[1]{pattr}", (0, "expr")), "attributes37": ("%[0]{pattr} import %c", (0, "IMPORT_NAME_ATTR"), (1, "IMPORT_FROM")), @@ -175,6 +175,20 @@ def customize_for_version37(self, version): pass return + def n_attribute37(node): + expr = node[0] + assert expr == "expr" + if expr[0] == "LOAD_CONST": + # FIXME: I didn't record which constants parenthesis is + # necessary. However, I suspect that we could further + # refine this by looking at operator precedence and + # eval'ing the constant value (pattr) and comparing with + # the type of the constant. + node.kind = "attribute_w_parens" + self.default(node) + + self.n_attribute37 = n_attribute37 + def n_call(node): p = self.prec self.prec = 100