bpo-44963: Implement send() and throw() methods for anext_awaitable objects#27955
bpo-44963: Implement send() and throw() methods for anext_awaitable objects#27955pablogsal merged 2 commits intopython:mainfrom
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() |
1st1
left a comment
There was a problem hiding this comment.
Looks good to me. Although I'm not sure this is a blocker-level thing.
1st1
left a comment
There was a problem hiding this comment.
@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 <yury@edgedb.com> (cherry picked from commit 533e725) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
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! |
https://bugs.python.org/issue44963