2.6 return_stmt bug

This commit is contained in:
rocky
2016-07-01 06:46:47 -04:00
parent 44c03ff7c7
commit fa6ae76a64
4 changed files with 15 additions and 1 deletions

Binary file not shown.

View File

@@ -0,0 +1,10 @@
# 2.6.9 asynchat.py
# 2.6 added:
# return_stmt ::= ret_expr RETURN_END_IF come_from_pop
def initiate_send(self):
while self:
if self:
x = 'a'
else:
del self.producer_fifo[0]
return

View File

@@ -299,6 +299,8 @@ class PythonParser(GenericASTBuilder):
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK COME_FROM
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK COME_FROM
# This is Python 2.7+; segregate
while1stmt ::= SETUP_LOOP return_stmts COME_FROM
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK else_suite COME_FROM

View File

@@ -123,11 +123,13 @@ class Python26Parser(Python2Parser):
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_cf_pop POP_BLOCK COME_FROM
while1stmt ::= SETUP_LOOP return_stmts POP_BLOCK COME_FROM
return_stmt ::= ret_expr RETURN_END_IF come_from_pop
return_if_stmt ::= ret_expr RETURN_END_IF come_from_pop
iflaststmtl ::= testexpr c_stmts_opt JUMP_BACK come_from_pop
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE come_from_pop
"""
def p_comp26(self, args):