Serhiy Storchaka added the comment:
Committed with non-dis test. Thank you for your contribution Bruno.
--
resolution: - fixed
stage: test needed - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
Roundup Robot added the comment:
New changeset 2b4a04c3681b by Serhiy Storchaka in branch '3.4':
Issue #23192: Fixed generator lambdas. Patch by Bruno Cauet.
https://hg.python.org/cpython/rev/2b4a04c3681b
New changeset a3b889e9d3f3 by Serhiy Storchaka in branch 'default':
Issue #23192: Fixed
Bruno Cauet added the comment:
Here is a working test, testing yield by lambda function as well as lambda
and function yielding from those.
--
Added file:
http://bugs.python.org/file38440/0001-Add-tests-for-issue-23192.patch
___
Python tracker
Serhiy Storchaka added the comment:
Could you please add a test based on Chris's example? And it would be good to
add a test for a lambda with yield from.
--
assignee: - serhiy.storchaka
stage: - test needed
___
Python tracker
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +ezio.melotti
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23192
___
___
Bruno Cauet added the comment:
Here are the operations being emitted (line, macro used and eventual argument):
f = lambda: (yield 5)
3487: ADDOP_O LOAD_CONST e-v.Num.n
3472: ADDOP YIELD_VALUE
1907: ADDOP_IN_SCOPE POP_TOP
4349: ADDOP_O LOAD_CONST Py_None
4350: ADDOP RETURN_VALUE
1457: ADDOP_O
Changes by Bruno Cauet brunoca...@gmail.com:
Added file:
http://bugs.python.org/file38299/0002-lambda-generator-fix-try-to-add-a-dis-test.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23192
Chris Angelico added the comment:
I'm not sure what to look for in the code generation. In compile.c lines 3456
and following, there's a LOAD_CONST None coming through, in the else branch of
if (e-v.Yield.value), but nothing talking about lambda functions. There are
constants
Changes by Serhiy Storchaka storch...@gmail.com:
--
nosy: +benjamin.peterson, gvanrossum, serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23192
___
Changes by Chris Angelico ros...@gmail.com:
--
type: - behavior
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23192
___
___
Python-bugs-list
New submission from Chris Angelico:
As yield is an expression, it's legal in a lambda function, which then
means you have a generator function. But it's not quite the same as
the equivalent function made with def:
$ python3
Python 3.5.0a0 (default:1c51f1650c42+, Dec 29 2014, 02:29:06)
[GCC
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23192
___
___
Python-bugs-list
Guido van Rossum added the comment:
Hm, looks like nobody bothered to update the lambda code generation to use the
value from yield. I almost feel like there is some unnecessary check if we are
in a lambda in the code generation for yield. Have you looked through the code
generation yet?
13 matches
Mail list logo