You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Need more precise "assert" for 3.8...
Add rule for ifelsestmtl which is needed in 3.8
This commit is contained in:
@@ -87,11 +87,16 @@ def ifelsestmt(self, lhs, n, rule, ast, tokens, first, last):
|
||||
if rule not in IFELSE_STMT_RULES:
|
||||
return False
|
||||
|
||||
# Avoid if/else where the "then" is a "raise_stmt1". Parse this
|
||||
# as an "assert" instead.
|
||||
# Avoid if/else where the "then" is a "raise_stmt1" for an
|
||||
# assert statemetn. Parse this as an "assert" instead.
|
||||
stmts = ast[1]
|
||||
if stmts in ("c_stmts",) and len(stmts) == 1 and stmts[0] == "raise_stmt1":
|
||||
return True
|
||||
if stmts in ("c_stmts",) and len(stmts) == 1:
|
||||
raise_stmt1 = stmts[0]
|
||||
if (
|
||||
raise_stmt1 == "raise_stmt1" and
|
||||
raise_stmt1[0] in ("LOAD_ASSERT",)
|
||||
):
|
||||
return True
|
||||
|
||||
# Make sure all of the "come froms" offset at the
|
||||
# end of the "if" come from somewhere inside the "if".
|
||||
|
Reference in New Issue
Block a user