Skip to content

Commit 1c16947

Browse files
committed
Respond to review feedback
1 parent ccf637d commit 1c16947

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

docs/source/tutorial/echo-server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ async def echo_server(server_stream):
2121
print("echo_server {}: received data {!r}".format(ident, data))
2222
await server_stream.send_all(data)
2323
print("echo_server {}: connection closed".format(ident))
24-
return
2524
# FIXME: add discussion of MultiErrors to the tutorial, and use
2625
# MultiError.catch here. (Not important in this case, but important if the
2726
# server code uses nurseries internally.)

newsfragments/959.feature.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
If you have a `~trio.abc.ReceiveStream` object, you can now use
22
``async for data in stream: ...`` instead of calling
3-
`~trio.abc.ReceiveStream.receive_some` repeatedly. And the best part
4-
is, it automatically checks for EOF for you, so you don't have to.
5-
Also, you no longer have to choose a magic buffer size value before
6-
calling `~trio.abc.ReceiveStream.receive_some`; you can now call
7-
``await stream.receive_some()`` and the stream will automatically pick
8-
a reasonable value for you.
3+
`~trio.abc.ReceiveStream.receive_some`. Each iteration gives an
4+
arbitrary sized chunk of bytes. And the best part is, the loop
5+
automatically exits when you reach EOF, so you don't have to check for
6+
it yourself anymore. Relatedly, you no longer need to pick a magic
7+
buffer size value before calling
8+
`~trio.abc.ReceiveStream.receive_some`; you can ``await
9+
stream.receive_some()`` with no arguments, and the stream will
10+
automatically pick a reasonable size for you.

trio/_abc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,9 @@ class ReceiveStream(AsyncResource):
379379
:class:`ReceiveChannel`.
380380
381381
`ReceiveStream` objects can be used in ``async for`` loops. Each iteration
382-
will produce an arbitrary size
382+
will produce an arbitrary sized chunk of bytes, like calling
383+
`receive_some` with no arguments. Every chunk will contain at least one
384+
byte, and the loop automatically exits when reaching end-of-file.
383385
384386
"""
385387
__slots__ = ()

trio/tests/test_ssl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ async def setup(**kwargs):
12351235
################
12361236

12371237
# Test https_compatible
1238-
_, ssl_listener, ssl_client = await setup(https_compatible=True,)
1238+
_, ssl_listener, ssl_client = await setup(https_compatible=True)
12391239

12401240
ssl_server = await ssl_listener.accept()
12411241

0 commit comments

Comments
 (0)