You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Use attr insead of pattrr for non-strings
This commit is contained in:
BIN
test/bytecode_3.6_run/05_long_literals.pyc
Normal file
BIN
test/bytecode_3.6_run/05_long_literals.pyc
Normal file
Binary file not shown.
@@ -376,11 +376,13 @@ class Scanner3(Scanner):
|
|||||||
for i, inst in enumerate(self.insts):
|
for i, inst in enumerate(self.insts):
|
||||||
|
|
||||||
opname = inst.opname
|
opname = inst.opname
|
||||||
|
argval = inst.argval
|
||||||
|
pattr = inst.argrepr
|
||||||
|
|
||||||
t = Token(
|
t = Token(
|
||||||
opname=opname,
|
opname=opname,
|
||||||
attr=inst.argval,
|
attr=argval,
|
||||||
pattr=inst.argrepr,
|
pattr=pattr,
|
||||||
offset=inst.offset,
|
offset=inst.offset,
|
||||||
linestart=inst.starts_line,
|
linestart=inst.starts_line,
|
||||||
op=inst.opcode,
|
op=inst.opcode,
|
||||||
@@ -431,8 +433,8 @@ class Scanner3(Scanner):
|
|||||||
j = xdis.next_offset(op, self.opc, jump_offset)
|
j = xdis.next_offset(op, self.opc, jump_offset)
|
||||||
come_from_opname = self.opname_for_offset(j)
|
come_from_opname = self.opname_for_offset(j)
|
||||||
|
|
||||||
if opname.startswith("SETUP_"):
|
if come_from_opname.startswith("SETUP_"):
|
||||||
come_from_type = opname[len("SETUP_") :]
|
come_from_type = come_from_opname[len("SETUP_") :]
|
||||||
come_from_name = "COME_FROM_%s" % come_from_type
|
come_from_name = "COME_FROM_%s" % come_from_type
|
||||||
pass
|
pass
|
||||||
elif inst.offset in self.except_targets:
|
elif inst.offset in self.except_targets:
|
||||||
@@ -465,8 +467,6 @@ class Scanner3(Scanner):
|
|||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
pattr = inst.argrepr
|
|
||||||
|
|
||||||
if op in self.opc.CONST_OPS:
|
if op in self.opc.CONST_OPS:
|
||||||
const = argval
|
const = argval
|
||||||
if iscode(const):
|
if iscode(const):
|
||||||
@@ -640,6 +640,8 @@ class Scanner3(Scanner):
|
|||||||
|
|
||||||
last_op_was_break = opname == "BREAK_LOOP"
|
last_op_was_break = opname == "BREAK_LOOP"
|
||||||
t.kind = opname
|
t.kind = opname
|
||||||
|
t.attr = argval
|
||||||
|
t.pattr = pattr
|
||||||
new_tokens.append(t)
|
new_tokens.append(t)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@@ -227,7 +227,7 @@ class NonterminalActions:
|
|||||||
self.indent_more(INDENT_PER_LEVEL)
|
self.indent_more(INDENT_PER_LEVEL)
|
||||||
sep = ""
|
sep = ""
|
||||||
if is_dict:
|
if is_dict:
|
||||||
keys = flat_elems[-1].pattr
|
keys = flat_elems[-1].attr
|
||||||
assert isinstance(keys, tuple)
|
assert isinstance(keys, tuple)
|
||||||
assert len(keys) == len(flat_elems) - 1
|
assert len(keys) == len(flat_elems) - 1
|
||||||
for i, elem in enumerate(flat_elems[:-1]):
|
for i, elem in enumerate(flat_elems[:-1]):
|
||||||
|
Reference in New Issue
Block a user