From 94038151f44206647de93f2bae86a2e0cc42c654 Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 18 Mar 2018 23:37:32 -0400 Subject: [PATCH] Add Python 3.6 mklambda rule --- test/bytecode_3.6/05_36lambda.pyc | Bin 0 -> 388 bytes test/simple_source/bug36/05_36lambda.py | 4 ++++ uncompyle6/parsers/parse3.py | 8 ++++++++ 3 files changed, 12 insertions(+) create mode 100644 test/bytecode_3.6/05_36lambda.pyc create mode 100644 test/simple_source/bug36/05_36lambda.py diff --git a/test/bytecode_3.6/05_36lambda.pyc b/test/bytecode_3.6/05_36lambda.pyc new file mode 100644 index 0000000000000000000000000000000000000000..741ea5ef4755ab1bb7b9676770168155f55fa39d GIT binary patch literal 388 zcmYjNu};H44D}@`YKzJO6C>L#4N^p>DB=sUuw^-=xoZ@3NvgOJ0%fBT{01Wv|8pyU z!GxUv!qW45lKp)4MXS|v2tTqn0Qe;Qg-`01fM=AnuZ8xGA_EO~AcM5vG6!?;!+1eL z2QRRrX6+vr1E|R`OC1z~svOK7;hca=O0RGa13U|wEK(_)-7I~^LnfE_5RV#<4GsH6%yd-QmLw`4oauO5X)&?9TZ$mK_i3W@Fc+Pe{A@?@;~$tC9T NF&)!elZ;08eFL=5PqhF5 literal 0 HcmV?d00001 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,