-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-44963: Implement send() and throw() methods for anext_awaitable objects #27955
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
Conversation
This does not cover the |
~Actually, I don't know if this is the way we should handle this, because this allows to call Or maybe we are fine, is late here (someone should check) :( Seems we are fine: >>> async def blech():
... yield 1
... yield 2
... yield 3
...
>>> x = blech()
>>> asend_obj = anext(x)
>>> asend_obj.send(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration: 1
>>> asend_obj.send(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: cannot reuse already awaited __anext__()/asend()
>>> asend_obj = anext(x)
>>> asend_obj.send(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration: 2
>>> asend_obj.send(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: cannot reuse already awaited __anext__()/asend() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Although I'm not sure this is a blocker-level thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pablogsal I'm still not sure about the semantics here. I need more time.
When you're done making the requested changes, leave the comment: |
@pablogsal I think this is a go for merging. |
@graingert Thomas, thanks for the thorough review. |
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
…bjects (pythonGH-27955) Co-authored-by: Yury Selivanov <[email protected]> (cherry picked from commit 533e725) Co-authored-by: Pablo Galindo Salgado <[email protected]>
GH-28198 is a backport of this pull request to the 3.10 branch. |
Thanks @1st1 for all the help and thanks @graingert for the reviews and the comments! |
…bjects (GH-27955) Co-authored-by: Yury Selivanov <[email protected]> (cherry picked from commit 533e725) Co-authored-by: Pablo Galindo Salgado <[email protected]>
https://bugs.python.org/issue44963