mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-91323: Revert "Allow overriding a future compliance check in asyncio.Task (GH-32197)" (GH-95442)
This reverts commit d4bb38f82b
.
This commit is contained in:
parent
d0d0154443
commit
0342c93a6b
5 changed files with 10 additions and 122 deletions
|
@ -252,10 +252,6 @@ class Task(futures._PyFuture): # Inherit Python Task implementation
|
|||
self._num_cancels_requested -= 1
|
||||
return self._num_cancels_requested
|
||||
|
||||
def _check_future(self, future):
|
||||
"""Return False if task and future loops are not compatible."""
|
||||
return futures._get_loop(future) is self._loop
|
||||
|
||||
def __step(self, exc=None):
|
||||
if self.done():
|
||||
raise exceptions.InvalidStateError(
|
||||
|
@ -296,7 +292,7 @@ class Task(futures._PyFuture): # Inherit Python Task implementation
|
|||
blocking = getattr(result, '_asyncio_future_blocking', None)
|
||||
if blocking is not None:
|
||||
# Yielded Future must come from Future.__iter__().
|
||||
if not self._check_future(result):
|
||||
if futures._get_loop(result) is not self._loop:
|
||||
new_exc = RuntimeError(
|
||||
f'Task {self!r} got Future '
|
||||
f'{result!r} attached to a different loop')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue