diff --git a/test/bytecode_3.6/05_36lambda.pyc b/test/bytecode_3.6/05_36lambda.pyc new file mode 100644 index 00000000..741ea5ef Binary files /dev/null and b/test/bytecode_3.6/05_36lambda.pyc differ diff --git a/test/simple_source/bug36/05_36lambda.py b/test/simple_source/bug36/05_36lambda.py new file mode 100644 index 00000000..d048b5ba --- /dev/null +++ b/test/simple_source/bug36/05_36lambda.py @@ -0,0 +1,4 @@ +# From Python 3.6 hmac.py +# needed to change mklamba rule +def __init__(self, msg = None, digestmod = None): + self.digest_cons = lambda d='': digestmod.new(d) diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 923fe60f..79562e31 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -886,6 +886,14 @@ class Python3Parser(PythonParser): # before. args_pos, args_kw, annotate_args, closure = token.attr stack_count = args_pos + args_kw + annotate_args + if closure: + rule = ('mklambda ::= %s%s%s%s' % + ('expr ' * stack_count, + 'load_closure ' * closure, + 'BUILD_TUPLE_1 LOAD_LAMBDA LOAD_CONST ', + opname)) + self.add_unique_rule(rule, opname, token.attr, customize) + rule = ('mkfunc ::= %s%s%s%s' % ('expr ' * stack_count, 'load_closure ' * closure,