Some Python 3.4 bugss fixed by using 3.5 rules

This commit is contained in:
rocky
2017-02-20 08:17:17 -05:00
parent 9491c67779
commit 493e4b14a1
3 changed files with 2 additions and 4 deletions

View File

@@ -141,6 +141,7 @@ class Python3Parser(PythonParser):
_ifstmts_jump ::= return_if_stmts
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD COME_FROM
_ifstmts_jump ::= c_stmts_opt COME_FROM
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE

View File

@@ -110,7 +110,6 @@ class Python35Parser(Python34Parser):
yield_from ::= expr GET_YIELD_FROM_ITER LOAD_CONST YIELD_FROM
_ifstmts_jump ::= c_stmts_opt COME_FROM
"""
def add_custom_rules(self, tokens, customize):

View File

@@ -331,7 +331,7 @@ class Scanner3(Scanner):
(next_opname not in ('END_FINALLY', 'POP_BLOCK',
# Python 3.0 only uses POP_TOP
'POP_TOP'))):
if (self.version >= 3.5 or
if (self.version >= 3.4 or
(inst.offset not in self.not_continue) or
(tokens[-1].type == 'RETURN_VALUE')):
opname = 'CONTINUE'
@@ -897,8 +897,6 @@ class Scanner3(Scanner):
# For now, we'll only tag forward jump.
if rtarget > offset:
self.fixed_jumps[offset] = rtarget
self.not_continue.add(pre_rtarget)
elif op == self.opc.SETUP_EXCEPT:
target = self.get_target(offset)