Skip to content

gh-74366: Fix the documentation of $ in PyArg_ParseTupleAndKeywords() - #155301

Merged
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:gh-74366-kwonly-doc
Aug 7, 2026
Merged

gh-74366: Fix the documentation of $ in PyArg_ParseTupleAndKeywords()#155301
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:gh-74366-kwonly-doc

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

The documentation says that all keyword-only arguments must also be optional, so | must always be specified before $. This has never been true: if | is not specified before $, the keyword-only arguments are required. The wording dates back to the addition of $ in 3.3 (bpo-14328) and has not been touched since.

Document also that | cannot be specified after $, and add examples of format strings with the corresponding Python signatures.

…ywords()

The keyword-only arguments are not always optional: they are required if
"|" was not specified before "$".  Document also that "|" cannot be
specified after "$", and add examples for "|" and "$".
@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels Aug 6, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Aug 6, 2026
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Aug 6, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33948853 | 📁 Comparing 2f19e5d against main (c3aefdb)

  🔍 Preview build  

1 file changed
± c-api/arg.html

@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) August 7, 2026 04:00
@serhiy-storchaka
serhiy-storchaka merged commit af930c1 into python:main Aug 7, 2026
28 of 29 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Aug 7, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@bedevere-app

bedevere-app Bot commented Aug 7, 2026

Copy link
Copy Markdown

GH-155308 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Aug 7, 2026
@bedevere-app

bedevere-app Bot commented Aug 7, 2026

Copy link
Copy Markdown

GH-155309 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Aug 7, 2026
@bedevere-app

bedevere-app Bot commented Aug 7, 2026

Copy link
Copy Markdown

GH-155310 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Aug 7, 2026
serhiy-storchaka added a commit that referenced this pull request Aug 7, 2026
…eywords() (GH-155301) (GH-155310)

The keyword-only arguments are not always optional: they are required if
"|" was not specified before "$".  Document also that "|" cannot be
specified after "$", and add examples for "|" and "$".
(cherry picked from commit af930c1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Aug 7, 2026
…eywords() (GH-155301) (GH-155309)

The keyword-only arguments are not always optional: they are required if
"|" was not specified before "$".  Document also that "|" cannot be
specified after "$", and add examples for "|" and "$".
(cherry picked from commit af930c1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
hugovk pushed a commit that referenced this pull request Aug 7, 2026
…eywords() (GH-155301) (#155308)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant