bpo-37251: Removes code check from _is_async_obj. by lisroach · Pull Request #15830 · python/cpython (original) (raw)
It should be possible that an awaitable object does not have a __code__
, so technically checking for the __code__
attribute in _is_async_obj
is incorrect. This faulty code check is also why things like: mock.MagicMock(spec=lambda x: x)
evaluate to True, even though they are not asynchronous.