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 verify bug in 3.2
This commit is contained in:
@@ -460,6 +460,7 @@ def get_python_parser(version, debug_parser, compile_mode='exec'):
|
|||||||
explanation of the different modes.
|
explanation of the different modes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# FIXME: there has to be a better way...
|
||||||
if version < 3.0:
|
if version < 3.0:
|
||||||
import uncompyle6.parsers.parse2 as parse2
|
import uncompyle6.parsers.parse2 as parse2
|
||||||
if compile_mode == 'exec':
|
if compile_mode == 'exec':
|
||||||
@@ -473,6 +474,11 @@ def get_python_parser(version, debug_parser, compile_mode='exec'):
|
|||||||
p = parse3.Python32Parser(debug_parser)
|
p = parse3.Python32Parser(debug_parser)
|
||||||
else:
|
else:
|
||||||
p = parse3.Python32ParserSingle(debug_parser)
|
p = parse3.Python32ParserSingle(debug_parser)
|
||||||
|
elif version == 3.4:
|
||||||
|
if compile_mode == 'exec':
|
||||||
|
p = parse3.Python34Parser(debug_parser)
|
||||||
|
else:
|
||||||
|
p = parse3.Python34ParserSingle(debug_parser)
|
||||||
elif version >= 3.5:
|
elif version >= 3.5:
|
||||||
if compile_mode == 'exec':
|
if compile_mode == 'exec':
|
||||||
p = parse3.Python35onParser(debug_parser)
|
p = parse3.Python35onParser(debug_parser)
|
||||||
@@ -484,6 +490,7 @@ def get_python_parser(version, debug_parser, compile_mode='exec'):
|
|||||||
else:
|
else:
|
||||||
p = parse3.Python3ParserSingle(debug_parser)
|
p = parse3.Python3ParserSingle(debug_parser)
|
||||||
p.version = version
|
p.version = version
|
||||||
|
# p.dumpGrammar() # debug
|
||||||
return p
|
return p
|
||||||
|
|
||||||
class PythonParserSingle(PythonParser):
|
class PythonParserSingle(PythonParser):
|
||||||
|
@@ -243,7 +243,6 @@ class Python3Parser(PythonParser):
|
|||||||
testtrue ::= expr jmp_true
|
testtrue ::= expr jmp_true
|
||||||
|
|
||||||
_ifstmts_jump ::= return_if_stmts
|
_ifstmts_jump ::= return_if_stmts
|
||||||
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_from
|
|
||||||
_ifstmts_jump ::= c_stmts_opt
|
_ifstmts_jump ::= c_stmts_opt
|
||||||
|
|
||||||
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE
|
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE
|
||||||
@@ -588,6 +587,13 @@ class Python32Parser(Python3Parser):
|
|||||||
"""
|
"""
|
||||||
# Store locals is only used in Python 3.2
|
# Store locals is only used in Python 3.2
|
||||||
designator ::= STORE_LOCALS
|
designator ::= STORE_LOCALS
|
||||||
|
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD COME_FROM
|
||||||
|
"""
|
||||||
|
|
||||||
|
class Python34Parser(Python3Parser):
|
||||||
|
def p_34(self, args):
|
||||||
|
"""
|
||||||
|
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_from
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Python3ParserSingle(Python3Parser, PythonParserSingle):
|
class Python3ParserSingle(Python3Parser, PythonParserSingle):
|
||||||
@@ -596,6 +602,9 @@ class Python3ParserSingle(Python3Parser, PythonParserSingle):
|
|||||||
class Python32ParserSingle(Python32Parser, PythonParserSingle):
|
class Python32ParserSingle(Python32Parser, PythonParserSingle):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class Python34ParserSingle(Python34Parser, PythonParserSingle):
|
||||||
|
pass
|
||||||
|
|
||||||
class Python35onParser(Python3Parser):
|
class Python35onParser(Python3Parser):
|
||||||
def p_35on(self, args):
|
def p_35on(self, args):
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user