mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
bpo-34890: Make iscoroutinefunction, isgeneratorfunction and isasyncgenfunction work with functools.partial (GH-9903)
inspect.isfunction() processes both inspect.isfunction(func) and inspect.isfunction(partial(func, arg)) correctly but some other functions in the inspect module (iscoroutinefunction, isgeneratorfunction and isasyncgenfunction) lack this functionality. This commits adds a new check in the mentioned functions in the inspect module so they can work correctly with arbitrarily nested partial functions.
This commit is contained in:
parent
e483f02423
commit
7cd2543416
6 changed files with 61 additions and 12 deletions
|
|
@ -298,6 +298,10 @@ attributes:
|
|||
|
||||
Return true if the object is a Python generator function.
|
||||
|
||||
.. versionchanged:: 3.8
|
||||
Functions wrapped in :func:`functools.partial` now return true if the
|
||||
wrapped function is a Python generator function.
|
||||
|
||||
|
||||
.. function:: isgenerator(object)
|
||||
|
||||
|
|
@ -311,6 +315,10 @@ attributes:
|
|||
|
||||
.. versionadded:: 3.5
|
||||
|
||||
.. versionchanged:: 3.8
|
||||
Functions wrapped in :func:`functools.partial` now return true if the
|
||||
wrapped function is a :term:`coroutine function`.
|
||||
|
||||
|
||||
.. function:: iscoroutine(object)
|
||||
|
||||
|
|
@ -352,6 +360,10 @@ attributes:
|
|||
|
||||
.. versionadded:: 3.6
|
||||
|
||||
.. versionchanged:: 3.8
|
||||
Functions wrapped in :func:`functools.partial` now return true if the
|
||||
wrapped function is a :term:`asynchronous generator` function.
|
||||
|
||||
|
||||
.. function:: isasyncgen(object)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue