[syntax-errors] Tuple unpacking in return and yield before Python 3.8 (#16485)

Summary
--

Checks for tuple unpacking in `return` and `yield` statements before
Python 3.8, as described [here].

Test Plan
--
Inline tests.

[here]: https://github.com/python/cpython/issues/76298
This commit is contained in:
Brent Westbrook 2025-03-06 11:57:20 -05:00 committed by GitHub
parent 0a627ef216
commit 6c14225c66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 1217 additions and 8 deletions

View file

@ -0,0 +1,3 @@
# parse_options: {"target-version": "3.7"}
rest = (4, 5, 6)
def f(): return 1, 2, 3, *rest

View file

@ -0,0 +1,4 @@
# parse_options: {"target-version": "3.7"}
rest = (4, 5, 6)
def g(): yield 1, 2, 3, *rest
def h(): yield 1, (yield 2, *rest), 3

View file

@ -0,0 +1,3 @@
# parse_options: {"target-version": "3.7"}
rest = (4, 5, 6)
def f(): return (1, 2, 3, *rest)

View file

@ -0,0 +1,3 @@
# parse_options: {"target-version": "3.8"}
rest = (4, 5, 6)
def f(): return 1, 2, 3, *rest

View file

@ -0,0 +1,3 @@
# parse_options: {"target-version": "3.7"}
rest = (4, 5, 6)
def g(): yield (1, 2, 3, *rest)

View file

@ -0,0 +1,4 @@
# parse_options: {"target-version": "3.8"}
rest = (4, 5, 6)
def g(): yield 1, 2, 3, *rest
def h(): yield 1, (yield 2, *rest), 3