bpo-37251: Removes __code__ check from _is_async_obj. (GH-15830)

This commit is contained in:
Lisa Roach 2019-09-10 12:18:40 +01:00 committed by GitHub
parent 5a7d2e11aa
commit f1a297acb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 3 deletions

View file

@ -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):