Skip to content

Commit dc72be1

Browse files
authored
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
1 parent 7ebe773 commit dc72be1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Doc/library/annotationlib.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,9 @@ following attributes:
535535
:attr:`~Format.VALUE_WITH_FAKE_GLOBALS`.
536536
* A :ref:`code object <code-objects>` ``__code__`` containing the compiled code for the
537537
annotate function.
538-
* Optional: A tuple of the function's positional defaults ``__kwdefaults__``, if the
538+
* Optional: A tuple of the function's positional defaults ``__defaults__``, if the
539539
function represented by ``__code__`` uses any positional defaults.
540-
* Optional: A dict of the function's keyword defaults ``__defaults__``, if the function
540+
* Optional: A dict of the function's keyword defaults ``__kwdefaults__``, if the function
541541
represented by ``__code__`` uses any keyword defaults.
542542
* Optional: All other :ref:`function attributes <inspect-types>`.
543543

0 commit comments

Comments
 (0)