mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #28634: Fix asyncio.isfuture() to support mocks
This commit is contained in:
parent
3b3a141a83
commit
49d6b8c0c3
2 changed files with 26 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue