Commit Graph
5 Commits
Author SHA1 Message Date
Christian Legnitto df79c0e3a9 Fix sub_table ordering for nested inlined comprehensions (PEP 709) (#7480)
When an inlined comprehension's first iterator expression contains
nested scopes (such as a lambda), those scopes' sub_tables appear at the
current position in the parent's sub_table list. The previous code
spliced the comprehension's own child sub_tables (e.g. inner inlined
comprehensions) into that same position before compiling the iterator,
which shifted the iterator's sub_tables to wrong indices.

Move the splice after the first iterator is compiled so its sub_tables
are consumed at their original positions.

Fixes nested list comprehensions like:
```python
    [[x for _, x in g] for _, g in itertools.groupby(..., lambda x: ...)]
```

Disclosure: I used AI to develop the patch though I was heavily
involved.
2026-03-22 17:23:03 +09:00
toofooboo 41979f0823 chore: fix some typos in comments (#5243)
Signed-off-by: toofooboo <cmaker@foxmail.com>
2024-04-19 21:10:22 +09:00
Jeong YunWon 4bd090887e Remove completed TODO 2023-02-13 21:28:19 +09:00
yt2b 65d2aca88f Add test in syntax_comprehension.py 2022-12-18 10:03:41 +09:00
Jeong Yunwon ff85fc9257 rename extra_tests to prefix form 2022-05-04 02:54:59 +09:00