You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
2.6 try statement (and below)
They may neeed arbitrary come_froms for each except clause
This commit is contained in:
@@ -169,12 +169,19 @@ class Scanner26(scan.Scanner2):
|
||||
oparg = None; pattr = None
|
||||
|
||||
if offset in jump_targets:
|
||||
k = 0
|
||||
for j in jump_targets[offset]:
|
||||
tokens.append(Token('COME_FROM', None, repr(j),
|
||||
offset="%s_%d" % (offset, k),
|
||||
has_arg = True))
|
||||
k += 1
|
||||
jump_idx = 0
|
||||
# We want to process COME_FROMs to the same offset to be in *descending*
|
||||
# offset order so we have the larger range or biggest instruction interval
|
||||
# last. (I think they are sorted in increasing order, but for safety
|
||||
# we sort them). That way, specific COME_FROM tags will match up
|
||||
# properly. For example, a "loop" with an "if" nested in it should have the
|
||||
# "loop" tag last so the grammar rule matches that properly.
|
||||
for jump_offset in sorted(jump_targets[offset], reverse=True):
|
||||
tokens.append(Token(
|
||||
'COME_FROM', None, repr(jump_offset),
|
||||
offset="%s_%d" % (offset, jump_idx),
|
||||
has_arg = True))
|
||||
jump_idx += 1
|
||||
|
||||
has_arg = (op >= self.opc.HAVE_ARGUMENT)
|
||||
if has_arg:
|
||||
|
Reference in New Issue
Block a user