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):
|
||||
|
||||
opname = inst.opname
|
||||
argval = inst.argval
|
||||
pattr = inst.argrepr
|
||||
|
||||
t = Token(
|
||||
opname=opname,
|
||||
attr=inst.argval,
|
||||
pattr=inst.argrepr,
|
||||
attr=argval,
|
||||
pattr=pattr,
|
||||
offset=inst.offset,
|
||||
linestart=inst.starts_line,
|
||||
op=inst.opcode,
|
||||
@@ -431,8 +433,8 @@ class Scanner3(Scanner):
|
||||
j = xdis.next_offset(op, self.opc, jump_offset)
|
||||
come_from_opname = self.opname_for_offset(j)
|
||||
|
||||
if opname.startswith("SETUP_"):
|
||||
come_from_type = opname[len("SETUP_") :]
|
||||
if come_from_opname.startswith("SETUP_"):
|
||||
come_from_type = come_from_opname[len("SETUP_") :]
|
||||
come_from_name = "COME_FROM_%s" % come_from_type
|
||||
pass
|
||||
elif inst.offset in self.except_targets:
|
||||
@@ -465,8 +467,6 @@ class Scanner3(Scanner):
|
||||
|
||||
pass
|
||||
|
||||
pattr = inst.argrepr
|
||||
|
||||
if op in self.opc.CONST_OPS:
|
||||
const = argval
|
||||
if iscode(const):
|
||||
@@ -640,6 +640,8 @@ class Scanner3(Scanner):
|
||||
|
||||
last_op_was_break = opname == "BREAK_LOOP"
|
||||
t.kind = opname
|
||||
t.attr = argval
|
||||
t.pattr = pattr
|
||||
new_tokens.append(t)
|
||||
pass
|
||||
|
||||
|
@@ -227,7 +227,7 @@ class NonterminalActions:
|
||||
self.indent_more(INDENT_PER_LEVEL)
|
||||
sep = ""
|
||||
if is_dict:
|
||||
keys = flat_elems[-1].pattr
|
||||
keys = flat_elems[-1].attr
|
||||
assert isinstance(keys, tuple)
|
||||
assert len(keys) == len(flat_elems) - 1
|
||||
for i, elem in enumerate(flat_elems[:-1]):
|
||||
|
Reference in New Issue
Block a user