diff --git a/test/bytecode_2.6_run/01_lambda_call.pyc b/test/bytecode_2.6_run/01_lambda_call.pyc new file mode 100644 index 00000000..48a7af00 Binary files /dev/null and b/test/bytecode_2.6_run/01_lambda_call.pyc differ diff --git a/test/bytecode_2.7_run/01_lambda_call.pyc b/test/bytecode_2.7_run/01_lambda_call.pyc new file mode 100644 index 00000000..2b82ec38 Binary files /dev/null and b/test/bytecode_2.7_run/01_lambda_call.pyc differ diff --git a/test/bytecode_3.7_run/01_lambda_call.pyc b/test/bytecode_3.7_run/01_lambda_call.pyc new file mode 100644 index 00000000..a22ac91c Binary files /dev/null and b/test/bytecode_3.7_run/01_lambda_call.pyc differ diff --git a/test/bytecode_3.8_run/01_lambda_call.pyc b/test/bytecode_3.8_run/01_lambda_call.pyc new file mode 100644 index 00000000..66218d4d Binary files /dev/null and b/test/bytecode_3.8_run/01_lambda_call.pyc differ diff --git a/test/simple_source/bug22/01_lambda_call.py b/test/simple_source/bug22/01_lambda_call.py new file mode 100644 index 00000000..b39c4974 --- /dev/null +++ b/test/simple_source/bug22/01_lambda_call.py @@ -0,0 +1,4 @@ +# From https://github.com/rocky/python-uncompyle6/issues/350 +# This is RUNNABLE! +a = (lambda x: x)(abs) +assert a(-3) == 3 diff --git a/uncompyle6/semantics/customize37.py b/uncompyle6/semantics/customize37.py index a9663b8d..91d25032 100644 --- a/uncompyle6/semantics/customize37.py +++ b/uncompyle6/semantics/customize37.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2020 by Rocky Bernstein +# Copyright (c) 2019-2021 by Rocky Bernstein # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -275,11 +275,16 @@ def customize_for_version37(self, version): and opname == "CALL_FUNCTION_1" or not re.match(r"\d", opname[-1]) ): + if node[0][0] == "_mklambda": + template = "(%c)(%p)" + else: + template = "%c(%p)" self.template_engine( - ("%c(%p)", + (template, (0, "expr"), (1, PRECEDENCE["yield"]-1)), - node) + node + ) self.prec = p self.prune() else: