mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
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>
This commit is contained in:
parent
9e3729bbd7
commit
edb59d5718
5 changed files with 57 additions and 4 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue