You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Python 2.6 a == b or c == d == 3 grammar bug
This commit is contained in:
@@ -112,7 +112,7 @@ with handling control flow. All of the Python decompilers I have looked
|
|||||||
at have the same problem. In some cases we can detect an erroneous
|
at have the same problem. In some cases we can detect an erroneous
|
||||||
decompilation and report that.
|
decompilation and report that.
|
||||||
|
|
||||||
About 90% of the decompilation of Python standard library packages in
|
Over 98% of the decompilation of Python standard library packages in
|
||||||
Python 2.7.12 verifies correctly. Over 99% of Python 2.7 and 3.3-3.5
|
Python 2.7.12 verifies correctly. Over 99% of Python 2.7 and 3.3-3.5
|
||||||
"weakly" verify. Python 2.6 drops down to 96% weakly verifying.
|
"weakly" verify. Python 2.6 drops down to 96% weakly verifying.
|
||||||
Other versions drop off in quality too.
|
Other versions drop off in quality too.
|
||||||
|
@@ -38,6 +38,12 @@ class PythonParser(GenericASTBuilder):
|
|||||||
# PyPy:
|
# PyPy:
|
||||||
'kvlist_n'])
|
'kvlist_n'])
|
||||||
|
|
||||||
|
def ast_first_offset(self, ast):
|
||||||
|
if hasattr(ast, 'offset'):
|
||||||
|
return ast.offset
|
||||||
|
else:
|
||||||
|
return self.ast_first_offset(ast[0])
|
||||||
|
|
||||||
def add_unique_rule(self, rule, opname, count, customize):
|
def add_unique_rule(self, rule, opname, count, customize):
|
||||||
"""Add rule to grammar, but only if it hasn't been added previously
|
"""Add rule to grammar, but only if it hasn't been added previously
|
||||||
opname and count are used in the customize() semantic the actions
|
opname and count are used in the customize() semantic the actions
|
||||||
|
@@ -157,7 +157,6 @@ class Python26Parser(Python2Parser):
|
|||||||
# Semantic actions want the else to be at position 3
|
# Semantic actions want the else to be at position 3
|
||||||
ifelsestmt ::= testexpr c_stmts_opt jf_cf_pop else_suite come_froms
|
ifelsestmt ::= testexpr c_stmts_opt jf_cf_pop else_suite come_froms
|
||||||
ifelsestmt ::= testexpr_then c_stmts_opt jf_cf_pop else_suite come_froms
|
ifelsestmt ::= testexpr_then c_stmts_opt jf_cf_pop else_suite come_froms
|
||||||
ifelsestmt ::= testexpr c_stmts_opt filler else_suitel come_froms POP_TOP
|
|
||||||
ifelsestmt ::= testexpr_then c_stmts_opt filler else_suitel come_froms POP_TOP
|
ifelsestmt ::= testexpr_then c_stmts_opt filler else_suitel come_froms POP_TOP
|
||||||
|
|
||||||
# Semantic actions want else_suitel to be at index 3
|
# Semantic actions want else_suitel to be at index 3
|
||||||
|
Reference in New Issue
Block a user