ruff/crates/ruff_python_parser/src/parser
Brent Westbrook 2382fe1f25
[syntax-errors] Tuple unpacking in for statement iterator clause before Python 3.9 (#16558)
Summary
--

This PR reuses a slightly modified version of the
`check_tuple_unpacking` method added for detecting unpacking in `return`
and `yield` statements to detect the same issue in the iterator clause
of `for` loops.

I ran into the same issue with a bare `for x in *rest: ...` example
(invalid even on Python 3.13) and added it as a comment on
https://github.com/astral-sh/ruff/issues/16520.

I considered just making this an additional `StarTupleKind` variant as
well, but this change was in a different version of Python, so I kept it
separate.

Test Plan
--

New inline tests.
2025-03-13 15:55:17 -04:00
..
snapshots Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
expression.rs [syntax-errors] Tuple unpacking in for statement iterator clause before Python 3.9 (#16558) 2025-03-13 15:55:17 -04:00
helpers.rs [syntax-errors] Named expressions in decorators before Python 3.9 (#16386) 2025-03-05 17:08:18 +00:00
mod.rs [syntax-errors] Parenthesized keyword argument names after Python 3.8 (#16482) 2025-03-06 12:18:13 -05:00
options.rs Start detecting version-related syntax errors in the parser (#16090) 2025-02-25 23:03:48 -05:00
pattern.rs Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
progress.rs Replace LALRPOP parser with hand-written parser (#10036) 2024-04-18 17:57:39 +05:30
recovery.rs Use CompactString for Identifier (#12101) 2024-07-01 10:06:02 +02:00
statement.rs [syntax-errors] Tuple unpacking in for statement iterator clause before Python 3.9 (#16558) 2025-03-13 15:55:17 -04:00
tests.rs Pass ParserOptions to the parser (#16220) 2025-02-19 10:50:50 -05:00