Skip to content

Comprehension inlining: Bug if comprehension contains a lambda#104357

@JelleZijlstra

Description

@JelleZijlstra

Code sample:

defouter(x): return [lambda: xforxinrange(x)] print([f() forfinouter(2)])

On 3.11, this produces [1, 1] as expected.

But on current main, I get:

>>> [f() for f in outer(2)] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 2, in outer TypeError: 'cell' object cannot be interpreted as an integer 

Almost certainly due to PEP 709 / #101441, cc @carljm.

Linked PRs

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions