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

Appearance settings

Comprehension inlining: Bug if comprehension contains a lambda #104357

Copy link
Copy link
Closed
@JelleZijlstra

Description

@JelleZijlstra
Issue body actions

Code sample:

def outer(x):
    return [lambda: x for x in range(x)]

print([f() for f in outer(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
Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.