Skip to content

gh-154320: Fix swapped __defaults__/__kwdefaults__ in annotationlib docs#154321

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
Solaris-star:fix/154320-annotationlib-defaults-docs
Jul 21, 2026
Merged

gh-154320: Fix swapped __defaults__/__kwdefaults__ in annotationlib docs#154321
JelleZijlstra merged 1 commit into
python:mainfrom
Solaris-star:fix/154320-annotationlib-defaults-docs

Conversation

@Solaris-star

@Solaris-star Solaris-star commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

In Doc/library/annotationlib.rst, under Creating a custom callable annotate function, the bullet list swapped attribute names:

  • said positional defaults are __kwdefaults__
  • said keyword defaults are __defaults__

Correct Python semantics:

  • __defaults__ — tuple of positional defaults
  • __kwdefaults__ — dict of keyword-only defaults

The example class body already used the correct attributes; only the prose was wrong.

Linked Issue

Closes #154320

…nlib docs

The bullet list under "Creating a custom callable annotate function"
had the attribute names reversed: positional defaults are __defaults__
(a tuple) and keyword defaults are __kwdefaults__ (a dict). The example
code below was already correct.

Fixes python#154320
@bedevere-app bedevere-app Bot added the docs Documentation in the Doc dir label Jul 21, 2026
@python-cla-bot

python-cla-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33680904 | 📁 Comparing b1742bc against main (20b7e8e)

  🔍 Preview build  

1 file changed
± library/annotationlib.html

@JelleZijlstra JelleZijlstra added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jul 21, 2026
@JelleZijlstra
JelleZijlstra enabled auto-merge (squash) July 21, 2026 12:45
@JelleZijlstra
JelleZijlstra merged commit dc72be1 into python:main Jul 21, 2026
39 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Jul 21, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @Solaris-star for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jul 21, 2026

Copy link
Copy Markdown

GH-154350 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 Jul 21, 2026
@bedevere-app

bedevere-app Bot commented Jul 21, 2026

Copy link
Copy Markdown

GH-154351 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 Jul 21, 2026
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.

Obvious keywords misuse for "__kwdefaults__" and "__defaults__"

2 participants