diff options
author | Yury Selivanov <yury@magic.io> | 2016-11-07 21:00:50 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-11-07 21:00:50 (GMT) |
commit | 49d6b8c0c3124e94728dd44aafc33becfb14415b (patch) | |
tree | c32c42dc11b85a2a083cc1cf4497034e298129b2 /Lib/asyncio | |
parent | 3b3a141a83a1e9141cecfdc1d2ee661f253b030c (diff) | |
download | cpython-49d6b8c0c3124e94728dd44aafc33becfb14415b.zip cpython-49d6b8c0c3124e94728dd44aafc33becfb14415b.tar.gz cpython-49d6b8c0c3124e94728dd44aafc33becfb14415b.tar.bz2 |
Issue #28634: Fix asyncio.isfuture() to support mocks
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/futures.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index bcd4d16..9ca8d84 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -2,7 +2,7 @@ __all__ = ['CancelledError', 'TimeoutError', 'InvalidStateError', - 'Future', 'wrap_future', + 'Future', 'wrap_future', 'isfuture', ] import concurrent.futures._base @@ -117,7 +117,8 @@ def isfuture(obj): itself as duck-type compatible by setting _asyncio_future_blocking. See comment in Future for more details. """ - return getattr(obj, '_asyncio_future_blocking', None) is not None + return (hasattr(obj.__class__, '_asyncio_future_blocking') and + obj._asyncio_future_blocking is not None) class Future: |