Specialize syntax error on unparenthesized `yield`
Open
@johnslavik is already working on this.
Since Sep 16, 2026.
interpreter-core
topic-parser
type-feature
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Feature or enhancement
Current vs proposed:
>>> def f():
... print(yield 1)
...
File "<python-input-0>", line 2
print(yield 1)
- ^^^^^
-SyntaxError: invalid syntax. Did you mean 'not'?
+ ^^^^^^^
+SyntaxError: yield expression as an argument must be parenthesized
PR in progress.
Linked PRs
- gh-157767
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.