From: Eugene Toder Date: Tue, 13 Oct 2020 23:48:19 +0000 (-0400) Subject: Fix await vs yield in the example X-Git-Tag: v6.2.0b1~61^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2936%2Fhead;p=thirdparty%2Ftornado.git Fix await vs yield in the example --- diff --git a/docs/guide/coroutines.rst b/docs/guide/coroutines.rst index aa8f62896..795631bf7 100644 --- a/docs/guide/coroutines.rst +++ b/docs/guide/coroutines.rst @@ -232,11 +232,11 @@ immediately, so you can start another operation before waiting. # This is equivalent to asyncio.ensure_future() (both work in Tornado). fetch_future = convert_yielded(self.fetch_next_chunk()) while True: - chunk = yield fetch_future + chunk = await fetch_future if chunk is None: break self.write(chunk) fetch_future = convert_yielded(self.fetch_next_chunk()) - yield self.flush() + await self.flush() .. testoutput:: :hide: