Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdbe171e

Browse files
gh-104602: Add additional test for listcomp with lambda (#104639)
This threw a SystemError before#104603. Adding a separate testbecause this was a different failure mode than the other two newtests from#104603, both of which used to segfault.
1 parent8a8853a commitdbe171e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎Lib/test/test_listcomps.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,16 @@ def test_nested_listcomp_in_lambda(self):
510510
"""
511511
self._check_in_scopes(code, {"z":1,"out": [(3,2,1)]})
512512

513+
deftest_lambda_in_iter(self):
514+
code="""
515+
(func, c), = [(a, b) for b in [1] for a in [lambda : a]]
516+
d = func()
517+
assert d is func
518+
# must use "a" in this scope
519+
e = a if False else None
520+
"""
521+
self._check_in_scopes(code, {"c":1,"e":None})
522+
513523
deftest_assign_to_comp_iter_var_in_outer_function(self):
514524
code="""
515525
a = [1 for a in [0]]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp