]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fix await vs yield in the example 2936/head
authorEugene Toder <eltoder@users.noreply.github.com>
Tue, 13 Oct 2020 23:48:19 +0000 (19:48 -0400)
committerGitHub <noreply@github.com>
Tue, 13 Oct 2020 23:48:19 +0000 (19:48 -0400)
docs/guide/coroutines.rst

index aa8f62896d118b17aed132b07a0772f7a437f05c..795631bf74a855f0144a6fe76a7c80c68932024d 100644 (file)
@@ -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: