mirror of
https://github.com/python/cpython.git
synced 2025-08-15 14:20:55 +00:00
bpo-37251: Removes __code__ check from _is_async_obj. (GH-15830)
(cherry picked from commit f1a297acb6
)
Co-authored-by: Lisa Roach <lisaroach14@gmail.com>
This commit is contained in:
parent
eaa1b09412
commit
c3008dd480
3 changed files with 20 additions and 3 deletions
|
@ -46,10 +46,9 @@ FILTER_DIR = True
|
|||
_safe_super = super
|
||||
|
||||
def _is_async_obj(obj):
|
||||
if getattr(obj, '__code__', None):
|
||||
return asyncio.iscoroutinefunction(obj) or inspect.isawaitable(obj)
|
||||
else:
|
||||
if _is_instance_mock(obj) and not isinstance(obj, AsyncMock):
|
||||
return False
|
||||
return asyncio.iscoroutinefunction(obj) or inspect.isawaitable(obj)
|
||||
|
||||
|
||||
def _is_async_func(func):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue