You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Fix Python 1.5- bug in handling unpack list
This commit is contained in:
@@ -13,6 +13,7 @@ class Python14Parser(Python15Parser):
|
||||
# SET_FUNC_ARGS, and RESERVE_FAST
|
||||
|
||||
# FIXME: should check that this indeed around __doc__
|
||||
# Possibly not strictly needed
|
||||
stmt ::= doc_junk
|
||||
doc_junk ::= LOAD_CONST POP_TOP
|
||||
|
||||
@@ -35,6 +36,26 @@ class Python14Parser(Python15Parser):
|
||||
super(Python14Parser, self).__init__(debug_parser)
|
||||
self.customized = {}
|
||||
|
||||
def customize_grammar_rules(self, tokens, customize):
|
||||
super(Python14Parser, self).customize_grammar_rules(tokens, customize)
|
||||
self.remove_rules("""
|
||||
whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt
|
||||
jb_pop
|
||||
POP_BLOCK else_suitel COME_FROM
|
||||
""")
|
||||
self.check_reduce['doc_junk'] = 'tokens'
|
||||
|
||||
|
||||
def reduce_is_invalid(self, rule, ast, tokens, first, last):
|
||||
invalid = super(Python14Parser,
|
||||
self).reduce_is_invalid(rule, ast,
|
||||
tokens, first, last)
|
||||
if invalid or tokens is None:
|
||||
return invalid
|
||||
if rule[0] == 'doc_junk':
|
||||
return not isinstance(tokens[first].pattr, str)
|
||||
|
||||
|
||||
|
||||
class Python14ParserSingle(Python14Parser, PythonParserSingle):
|
||||
pass
|
||||
|
Reference in New Issue
Block a user