# Crash report ### What happened? When CPython 3.12 is built with assertions enabled, the following snippet causes the interpreter to crash: ```python x = lambda: (yield 3) next(x()) ``` ``` $ ./python /tmp/LambdasTest.py python: Objects/genobject.c:400: gen_close: Assertion `exception_handler_depth > 0' failed. Aborted (core dumped) ``` This doesn't happen with 3.11 or with main. From a quick bisect: - #115818 (eb4774d2b7f5d50cd3cb8dc5abce9f94ce54197e) broke it on 3.12 - #111459 (52cc4af6ae9002f11605f91b672746c127494efd) fixed it on main This was triggered in the wild by Nuitka's test suite: https://github.com/Nuitka/Nuitka/issues/2893. CC @iritkatriel ### CPython versions tested on: 3.12 ### Operating systems tested on: Linux ### Output from running 'python -VV' on the command line: Python 3.12.3+ (heads/3.12:6d9677d78e, Jun 1 2024, 11:06:51) [GCC 14.1.1 20240516] <!-- gh-linked-prs --> ### Linked PRs * gh-120467 * gh-120658 * gh-120673 <!-- /gh-linked-prs -->
Activity
mgorny commentedon Jun 10, 2024
Gentle ping.
mgorny commentedon Jun 12, 2024
Given no reply, I'm going to revert this change in Gentoo. Hope that doesn't cause more issues.
dev-lang/python: Bump to 3.12.4_p1
iritkatriel commentedon Jun 13, 2024
Thanks. I agree, let's revert the bad commit in 3.12.
gh-119897: Add test for lambda generator invocation (#120658)
pythongh-119897: Add test for lambda generator invocation (pythonGH-1…
[3.12] gh-119897: Revert buggy optimization which was removed in 3.13 (…
iritkatriel commentedon Jun 18, 2024
Thanks.
mgorny commentedon Jun 18, 2024
Thank you!
[3.13] gh-119897: Add test for lambda generator invocation (GH-120658) (
pythongh-119897: Add test for lambda generator invocation (python#120658
pythongh-119897: Add test for lambda generator invocation (python#120658
pythongh-119897: Add test for lambda generator invocation (python#120658