Skip to content

gh-156675: Exclude annotations from the documented lambda grammar - #159831

Open
limadog9 wants to merge 1 commit into
python:mainfrom
limadog9:gh-156675-lambda-grammar
Open

limadog9 wants to merge 1 commit into
python:mainfrom
limadog9:gh-156675-lambda-grammar

Conversation

@limadog9

@limadog9 limadog9 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #156675.

The lambda production reused the function parameter grammar, which permits annotations. Define lambda-specific parameter productions using identifiers directly, while retaining positional-only parameters, defaults, variadic parameters, keyword-only parameters, and trailing commas.

Validation: the full Sphinx HTML build passed with warnings treated as errors, and sphinx-lint and git diff --check passed. Cross-checked 11 valid lambda forms and four rejected annotation forms against the current parser.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35258017 | 📁 Comparing af5a862 against main (0fba211)

  🔍 Preview build  

1 file changed
± reference/expressions.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

lambda grammar in the language reference incorrectly allows annotations

1 participant