You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
3.7+ use attribute_w_parens like we do in pre 3.7
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/bytecode_3.7_run/04_call_function.pyc
Normal file
BIN
test/bytecode_3.7_run/04_call_function.pyc
Normal file
Binary file not shown.
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user