Irit Katriel <iritkatr...@yahoo.com> added the comment:
The two implementations of iscoroutinefunction are implemented differently: in inspect: def iscoroutinefunction(obj): """Return true if the object is a coroutine function. Coroutine functions are defined with "async def" syntax. """ return _has_code_flag(obj, CO_COROUTINE) and in asyncio: def iscoroutinefunction(func): """Return True if func is a decorated coroutine function.""" return (inspect.iscoroutinefunction(func) or getattr(func, '_is_coroutine', None) is _is_coroutine) originally the asyncio version had only the _is_coroutine check: https://github.com/python/cpython/commit/f951d28ac890063e3ecef56aa8cf851b1152d9dd the inspect check was added later. See also issue28703, where the asyncio version was fixed to handle mock objects. Looks like the inspect version needs to be fixed as well. ---------- nosy: +iritkatriel _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40573> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com