Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update news and docs
Signed-off-by: Manjusaka <me@manjusaka.me>
  • Loading branch information
Zheaoli committed Oct 15, 2025
commit 0e8a69897430fe26edb6fd4e3f8ba0ef9faa5294
12 changes: 6 additions & 6 deletions Doc/library/annotationlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ Functions
doesn't have its own annotations dict, returns an empty dict.
* All accesses to object members and dict values are done
using ``getattr()`` and ``dict.get()`` for safety.
* For :class:`functools.partial` and :class:`functools.partialmethod` objects,
only returns annotations for parameters that have not been bound by the
partial application, along with the return annotation if present.
See :ref:`below <functools-objects-annotations>` for details.
* Supports objects that provide their own :attr:`~object.__annotate__` method,
Comment thread
Zheaoli marked this conversation as resolved.
Outdated
such as :class:`functools.partial` and :class:`functools.partialmethod`.
See :ref:`below <functools-objects-annotations>` for details on using
:func:`!get_annotations` with :mod:`functools` objects.

*eval_str* controls whether or not values of type :class:`!str` are
replaced with the result of calling :func:`eval` on those values:
Expand All @@ -394,10 +394,10 @@ Functions
to the *obj* class namespace.
* If *obj* is a callable, *globals* defaults to
:attr:`obj.__globals__ <function.__globals__>`.
If *obj* has a :attr:`~function.__wrapped__` attribute (such as functions
If *obj* has a ``__wrapped__`` attribute (such as functions
decorated with :func:`functools.update_wrapper`), or if it is a
:class:`functools.partial` object, it is unwrapped by following the
:attr:`!__wrapped__` attribute or :attr:`~functools.partial.func` attribute
``__wrapped__`` attribute or :attr:`~functools.partial.func` attribute
repeatedly until a function with :attr:`~function.__globals__` is found.
Comment thread
Zheaoli marked this conversation as resolved.
Outdated

Calling :func:`!get_annotations` is best practice for accessing the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Support :class:`functools.partial` and :class:`functools.partialmethod`
inspect in :func:`annotationlib.get_annotations`
Support `__annotate__` for :class:`functools.partial`
and :class:`functools.partialmethod`
Loading