3.6+ lambda parameter handling

This commit is contained in:
rocky
2019-04-18 14:21:52 -04:00
parent bd0db6c539
commit 52af2ba32a
3 changed files with 18 additions and 6 deletions

Binary file not shown.

View File

@@ -1,6 +1,12 @@
# From Python 3.3.6 hmac.py
# Problem was getting wrong placement of positional args
# Problem was getting wrong placement of positional args.
# In 3.6+ paramter handling changes
# RUNNABLE!
digest_cons = lambda d=b'': 5
# Handle single kwarg
lambda *, d=0: None
x = lambda *, d=0: d
assert x(d=1) == 1
assert x() == 0

View File

@@ -953,11 +953,17 @@ class Python3Parser(PythonParser):
opname))
self.add_unique_rule(rule, opname, token.attr, customize)
else:
rule = ('mklambda ::= %sLOAD_LAMBDA LOAD_CONST %s' %
(('expr ' * stack_count), opname))
self.add_unique_rule(rule, opname, token.attr, customize)
rule = ('mkfunc ::= %s%s%s%s' %
('expr ' * stack_count,
'load_closure ' * closure,
'LOAD_CONST ' * 2,
opname))
('expr ' * stack_count,
'load_closure ' * closure,
'LOAD_CONST ' * 2,
opname))
self.add_unique_rule(rule, opname, token.attr, customize)
if has_get_iter_call_function1: