mirror of
https://github.com/python/cpython.git
synced 2025-10-25 18:54:53 +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
|
|
@ -440,8 +440,8 @@ async def func(x, y):
|
|||
|
||||
coro_repr = repr(task._coro)
|
||||
expected = (
|
||||
r'<CoroWrapper \w+.test_task_repr_partial_corowrapper'
|
||||
r'\.<locals>\.func\(1\)\(\) running, '
|
||||
r'<coroutine object \w+\.test_task_repr_partial_corowrapper'
|
||||
r'\.<locals>\.func at'
|
||||
)
|
||||
self.assertRegex(coro_repr, expected)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue