ret_expr -> return_expr

This matches Python's AST a little more closely
This commit is contained in:
rocky
2022-01-03 21:51:32 -05:00
parent 7f42694c25
commit deea74b6a8
20 changed files with 92 additions and 92 deletions

View File

@@ -5,7 +5,7 @@
# fully handle Python 3.5's jump optimization
# So in 3.5, for now, we allow:
#
# return_stmt ::= ret_expr RETURN_END_IF
# return_stmt ::= return_expr RETURN_END_IF
# and you see that in the grammar rules for below.
# For other pythons the RETURN_END_IF may be a

View File

@@ -1,9 +1,9 @@
# Tests:
# ret_expr_or_cond ::= ret_expr
# if_exp_ret ::= expr POP_JUMP_IF_FALSE expr RETURN_END_IF ret_expr_or_cond
# ret_expr_or_cond ::= if_exp_ret
# ret_or ::= expr JUMP_IF_TRUE_OR_POP ret_expr_or_cond COME_FROM
# return_expr_or_cond ::= return_expr
# if_exp_ret ::= expr POP_JUMP_IF_FALSE expr RETURN_END_IF return_expr_or_cond
# return_expr_or_cond ::= if_exp_ret
# ret_or ::= expr JUMP_IF_TRUE_OR_POP return_expr_or_cond COME_FROM
# See https://github.com/rocky/python-uncompyle6/issues/5

View File

@@ -1,22 +1,22 @@
# 2.6.9 asynchat.py
# 2.6 added:
# return_stmt ::= ret_expr RETURN_END_IF come_from_pop
def initiate_send(self):
# return_stmt ::= return_expr RETURN_END_IF come_from_pop
def initiate_send(self, x):
while self:
if self:
x = 'a'
else:
del self.producer_fifo[0]
return
return x
# 2.6.9 contextlib.py
# Bug was in return exc, so added:
# return_stmt ::= ret_expr RETURN_VALUE_IF come_from_pop
# return_stmt ::= return_expr RETURN_VALUE_IF come_from_pop
def __exit__(self, type, value, traceback):
try:
raise RuntimeError
except StopIteration:
return exc
return value
except:
raise

View File

@@ -1,6 +1,6 @@
# from 2.6.9 Bastion.py
# Should see in 2.6.9:
# return_if_stmt ::= ret_expr RETURN_END_IF come_from_pop
# return_if_stmt ::= return_expr RETURN_END_IF come_from_pop
def Bastion(object, filter = lambda name: name[:1] != '_'):
def get1(name, attribute, MethodType, object=object, filter=filter):