diff options
author | Martijn Pieters <mj@zopatista.com> | 2024-02-15 11:08:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-15 11:08:45 (GMT) |
commit | edb59d57188e5535729c3948d673d0de1b729c05 (patch) | |
tree | 8de60290f8eda9ffc8dd5e060966218c7c5aed4e /Doc/library/inspect.rst | |
parent | 9e3729bbd77fb9dcaea6a06ac760160136d80b79 (diff) | |
download | cpython-edb59d57188e5535729c3948d673d0de1b729c05.zip cpython-edb59d57188e5535729c3948d673d0de1b729c05.tar.gz cpython-edb59d57188e5535729c3948d673d0de1b729c05.tar.bz2 |
bpo-38364: unwrap partialmethods just like we unwrap partials (#16600)
* bpo-38364: unwrap partialmethods just like we unwrap partials
The inspect.isgeneratorfunction, inspect.iscoroutinefunction and inspect.isasyncgenfunction already unwrap functools.partial objects, this patch adds support for partialmethod objects as well.
Also: Rename _partialmethod to __partialmethod__.
Since we're checking this attribute on arbitrary function-like objects,
we should use the namespace reserved for core Python.
---------
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Diffstat (limited to 'Doc/library/inspect.rst')
-rw-r--r-- | Doc/library/inspect.rst | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index f8b3e39..8a74cad 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -340,6 +340,9 @@ attributes (see :ref:`import-mod-attrs` for module attributes): Functions wrapped in :func:`functools.partial` now return ``True`` if the wrapped function is a Python generator function. + .. versionchanged:: 3.13 + Functions wrapped in :func:`functools.partialmethod` now return ``True`` + if the wrapped function is a Python generator function. .. function:: isgenerator(object) @@ -363,6 +366,10 @@ attributes (see :ref:`import-mod-attrs` for module attributes): Sync functions marked with :func:`markcoroutinefunction` now return ``True``. + .. versionchanged:: 3.13 + Functions wrapped in :func:`functools.partialmethod` now return ``True`` + if the wrapped function is a :term:`coroutine function`. + .. function:: markcoroutinefunction(func) @@ -429,6 +436,9 @@ attributes (see :ref:`import-mod-attrs` for module attributes): Functions wrapped in :func:`functools.partial` now return ``True`` if the wrapped function is a :term:`asynchronous generator` function. + .. versionchanged:: 3.13 + Functions wrapped in :func:`functools.partialmethod` now return ``True`` + if the wrapped function is a :term:`coroutine function`. .. function:: isasyncgen(object) |