-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Labels
trackingA "meta" issue that tracks completion of a bigger task via a list of smaller scoped issues.A "meta" issue that tracks completion of a bigger task via a list of smaller scoped issues.
Description
This is an umbrella issue to collect all the syntax errors that are raised by the CPython compiler. These are different than the ones that are raised by the parser. IOW, the source code which raises these errors are valid as per the grammar.
- Duplicate parameter names ([syntax-errors] Make duplicate parameter names a semantic error #17131)
-
awaitoutside async function (PLE1142) ([syntax-errors]awaitoutside async functions #17363) -
yieldoutside function (F704) ([syntax-errors]yield,yield from, andawaitoutside functions #17298) -
returnoutside function (F706) ([syntax-errors]returnoutside function #17300) -
awaitin annotations (extending theyieldand named expression handling from [syntax-errors] Invalid syntax in annotations #17101) ([syntax-errors] Extend annotation checks toawait#17282) - PEP 649 annotations in annotated assignments ([syntax-errors] Check annotations in annotated assignments #17283)
- Ruff fails to reject invalid syntax in annotation scopes #11118 ([syntax-errors] Invalid syntax in annotations #17101)
- Duplicate key in mapping
matchpattern (case {"x": 1, "x": 2}:) ([syntax-errors] Detect duplicate keys inmatchmapping patterns #17129) - Name assigned before
globaldeclaration (PLE0118) ([syntax-errors] Reimplement PLE0118 #17135) - Flag starred expressions in
returnandyield#16520 ([syntax-errors] Starred expressions in return, yield, and for #17134) - Ruff doesn't raise syntax error for single starred assignment target #13759 (cpython#100581)
- Multiple assignments to name 'a' in pattern (
case [a, b, a]:) - Irrefutable patterns are syntax errors
SyntaxError: name capture 'x' makes remaining patterns unreachableSyntaxError: wildcard makes remaining patterns unreachable
- Ruff fails to detect duplicate type parameter names #11119
- No syntax error for
[(a := ...) for a in b]#14395
A lot of them are mentioned in this comment. These all would be part of E999 rule.
Version-related errors
The following are both version-related and detected by the compiler. Many of them were originally tracked in #6591.
3.13
-
(cpython#111123) ([syntax-errors] Document behavior ofglobaldeclarations intrynodesglobaldeclarations intrynodes before 3.13 #17285)- Are now allowed in
exceptblocks if the variable is only referenced in anelseblock - Are now disallowed in
elseblocks if the variable is only referenced in anexceptblock
- Are now allowed in
3.11
- Async comprehensions are now allowed when nested inside sync comprehensions in async functions (cpython#77527) ([syntax-errors] Async comprehension in sync comprehension #17177)
3.10
-
del __debug__is a syntax error on Python 3.10+ (cpython#89163)
Reactions are currently unavailable
Sub-issues
Metadata
Metadata
Assignees
Labels
trackingA "meta" issue that tracks completion of a bigger task via a list of smaller scoped issues.A "meta" issue that tracks completion of a bigger task via a list of smaller scoped issues.