New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
asyncio: C implemeted Future cause Tornado test fail #72616
Comments
Another test failure is reported.
|
pure Python Future.__iter__ don't use what yield-ed. def __iter__(self):
if not self.done():
self._asyncio_future_blocking = True
yield self # This tells Task to wait for completion.
assert self.done(), "yield from wasn't used with future"
return self.result() # May raise too. I felt no-None value is sent by iter.send(val) wasn't make sense. So this patch ignores when non-None value is passed. |
Test failure in GNS3 seems not relating to this. |
The patch looks good. 2 things:
class Future:
def __iter__(self):
if not self.done():
self._asyncio_future_blocking = True
yield self # This tells Task to wait for completion.
assert self.done(), "yield from wasn't used with future"
return self.result() # May raise too. ^-- Future.__iter__ doesn't care about values that are pushed to the generator, it just returns "self.result()". |
New changeset b471447352ac by INADA Naoki in branch '3.6': New changeset bd141ec2973a by INADA Naoki in branch 'default': |
+- Issue bpo-28430: Fix iterator of C implemented asyncio.Future doesn't accept + non-None value is passed to it.send(val). This NEWS entry is not a coherent English sentence. Please revise. I don't understand it well enough to suggest a revision, but would review a replacement. |
I'm sorry about my bad English.
This meant: fut = asyncio.Future() # C implemented version of asyncio.Future
it = iter(fut) # Iterator of it
it.send(42) # raised TypeError before. It was not compatible with Python version of asyncio.Future |
Misc/NEWS
so that it is managed by towncrier #552Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: