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

JelleZijlstra <[email protected]>
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/dc72be1923a37042aee60354059e43d472de7803
commit: dc72be1923a37042aee60354059e43d472de7803
branch: main
author: Solaris-star <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2026-07-21T12:45:42Z
summary:

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

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 #154320

files:
M Doc/library/annotationlib.rst

diff --git a/Doc/library/annotationlib.rst b/Doc/library/annotationlib.rst
index af28fe0e2fde2f..a90754620b59fd 100644
--- a/Doc/library/annotationlib.rst
+++ b/Doc/library/annotationlib.rst
@@ -535,9 +535,9 @@ following attributes:
   :attr:`~Format.VALUE_WITH_FAKE_GLOBALS`.
 * A :ref:`code object <code-objects>` ``__code__`` containing the compiled code for the
   annotate function.
-* Optional: A tuple of the function's positional defaults ``__kwdefaults__``, if the
+* Optional: A tuple of the function's positional defaults ``__defaults__``, if the
   function represented by ``__code__`` uses any positional defaults.
-* Optional: A dict of the function's keyword defaults ``__defaults__``, if the function
+* Optional: A dict of the function's keyword defaults ``__kwdefaults__``, if the function
   represented by ``__code__`` uses any keyword defaults.
 * Optional: All other :ref:`function attributes <inspect-types>`.
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.