◐ Shell
clean mode source ↗

[3.8] bpo-38242: Revert "bpo-36889: Merge asyncio streams (GH-13251)" (#16482) by 1st1 · Pull Request #16485 · python/cpython

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as 3.9 PR.

await sleep(0)
# Yield to the event loop so connection_lost() may be
# called. Without this, _drain_helper() would return
# immediately, and code that calls
# write(...); await drain()
# in a loop would never call connection_lost(), so it
# would not see an error when the socket is closed.
await tasks.sleep(0, loop=self._loop)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've actually merged the comment, but the await sleep(0) line is correct.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the await sleep(0) line is correct

Oh you're right, there's no reason to explicitly pass the loop argument there, that wasn't intentional.