You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 16:59:52 +08:00
Adapt decompyle3's 3.8 try/return grammar rules
This commit is contained in:
@@ -2053,10 +2053,17 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
elif typ == "c":
|
||||
index = entry[arg]
|
||||
if isinstance(index, tuple):
|
||||
assert node[index[0]] == index[1], (
|
||||
"at %s[%d], expected '%s' node; got '%s'"
|
||||
% (node.kind, arg, index[1], node[index[0]].kind)
|
||||
)
|
||||
if isinstance(index[1], str):
|
||||
assert node[index[0]] == index[1], (
|
||||
"at %s[%d], expected '%s' node; got '%s'"
|
||||
% (node.kind, arg, index[1], node[index[0]].kind)
|
||||
)
|
||||
else:
|
||||
assert node[index[0]] in index[1], (
|
||||
"at %s[%d], expected to be in '%s' node; got '%s'"
|
||||
% (node.kind, arg, index[1], node[index[0]].kind)
|
||||
)
|
||||
|
||||
index = index[0]
|
||||
assert isinstance(
|
||||
index, int
|
||||
@@ -2065,6 +2072,16 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
arg,
|
||||
type(index),
|
||||
)
|
||||
|
||||
try:
|
||||
node[index]
|
||||
except IndexError:
|
||||
raise RuntimeError(
|
||||
"""
|
||||
Expanding '%' in template '%s[%s]':
|
||||
%s is invalid; has only %d entries
|
||||
""" % (node,kind, enty, arg, index, len(node))
|
||||
)
|
||||
self.preorder(node[index])
|
||||
|
||||
arg += 1
|
||||
|
Reference in New Issue
Block a user