You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
adjust "assert" transformation due to grammar ...
simplification
This commit is contained in:
@@ -113,7 +113,7 @@ class TreeTransform(GenericASTTraversal, object):
|
|||||||
|
|
||||||
testexpr = node[0]
|
testexpr = node[0]
|
||||||
|
|
||||||
if testexpr != "testexpr":
|
if testexpr.kind != "testexpr":
|
||||||
return node
|
return node
|
||||||
|
|
||||||
if node.kind in ("ifstmt", "ifstmtl"):
|
if node.kind in ("ifstmt", "ifstmtl"):
|
||||||
@@ -129,11 +129,10 @@ class TreeTransform(GenericASTTraversal, object):
|
|||||||
stmts = node[1]
|
stmts = node[1]
|
||||||
|
|
||||||
if stmts in ("c_stmts",) and len(stmts) == 1:
|
if stmts in ("c_stmts",) and len(stmts) == 1:
|
||||||
stmt = stmts[0]
|
raise_stmt = stmts[0]
|
||||||
raise_stmt = stmt[0]
|
|
||||||
testtrue_or_false = testexpr[0]
|
testtrue_or_false = testexpr[0]
|
||||||
if (
|
if (
|
||||||
raise_stmt == "raise_stmt1"
|
raise_stmt.kind == "raise_stmt1"
|
||||||
and 1 <= len(testtrue_or_false) <= 2
|
and 1 <= len(testtrue_or_false) <= 2
|
||||||
and raise_stmt.first_child().pattr == "AssertionError"
|
and raise_stmt.first_child().pattr == "AssertionError"
|
||||||
):
|
):
|
||||||
|
Reference in New Issue
Block a user