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:
Miss Islington (bot) 2019-09-10 06:16:00 -07:00 committed by GitHub
parent eaa1b09412
commit c3008dd480
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):