]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fix IOLoop doc example code
authorPeter Nelson <peter@peterdn.com>
Tue, 14 Aug 2018 02:42:45 +0000 (21:42 -0500)
committerBen Darnell <ben@bendarnell.com>
Sun, 16 Sep 2018 17:48:41 +0000 (13:48 -0400)
tornado/ioloop.py

index f7ee6dd60e9284bc0a08e805062dfdab3590c38a..8e89c2e35b6c7df1ffdcc522c08c874b83b0d618 100644 (file)
@@ -101,7 +101,7 @@ class IOLoop(Configurable):
         import socket
 
         import tornado.ioloop
-        from tornado import gen
+        from tornado.gen import convert_yielded
         from tornado.iostream import IOStream
 
         async def handle_connection(connection, address):
@@ -118,7 +118,8 @@ class IOLoop(Configurable):
                         raise
                     return
                 connection.setblocking(0)
-                handle_connection(connection, address)
+                coro = handle_connection(connection, address)
+                convert_yielded(coro)
 
         if __name__ == '__main__':
             sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)