@@ -1363,17 +1363,19 @@ cdef class Loop:
13631363
13641364 return future.result()
13651365
1366- def getaddrinfo (self , object host , object port , *,
1367- int family = 0 , int type = 0 , int proto = 0 , int flags = 0 ):
1366+ @cython.iterable_coroutine
1367+ async def getaddrinfo(self , object host, object port, * ,
1368+ int family = 0 , int type = 0 , int proto = 0 , int flags = 0 ):
13681369
13691370 addr = __static_getaddrinfo_pyaddr(host, port, family,
13701371 type , proto, flags)
13711372 if addr is not None :
13721373 fut = self ._new_future()
13731374 fut.set_result([addr])
1374- return fut
1375+ return await fut
13751376
1376- return self ._getaddrinfo(host, port, family, type , proto, flags, 1 )
1377+ return await self ._getaddrinfo(
1378+ host, port, family, type , proto, flags, 1 )
13771379
13781380 @cython.iterable_coroutine
13791381 async def getnameinfo(self , sockaddr, int flags = 0 ):
@@ -2102,7 +2104,8 @@ cdef class Loop:
21022104 """ Remove a writer callback."""
21032105 self ._remove_writer(fileobj)
21042106
2105- def sock_recv (self , sock , n ):
2107+ @cython.iterable_coroutine
2108+ async def sock_recv(self , sock, n):
21062109 """ Receive data from the socket.
21072110
21082111 The return value is a bytes object representing the data received.
@@ -2126,9 +2129,10 @@ cdef class Loop:
21262129 fut, sock, n)
21272130
21282131 self ._add_reader(sock, handle)
2129- return fut
2132+ return await fut
21302133
2131- def sock_recv_into (self , sock , buf ):
2134+ @cython.iterable_coroutine
2135+ async def sock_recv_into(self , sock, buf):
21322136 """ Receive data from the socket.
21332137
21342138 The received data is written into *buf* (a writable buffer).
@@ -2151,7 +2155,7 @@ cdef class Loop:
21512155 fut, sock, buf)
21522156
21532157 self ._add_reader(sock, handle)
2154- return fut
2158+ return await fut
21552159
21562160 @cython.iterable_coroutine
21572161 async def sock_sendall(self , sock, data):
@@ -2206,7 +2210,8 @@ cdef class Loop:
22062210 finally :
22072211 socket_dec_io_ref(sock)
22082212
2209- def sock_accept (self , sock ):
2213+ @cython.iterable_coroutine
2214+ async def sock_accept(self , sock):
22102215 """ Accept a connection.
22112216
22122217 The socket must be bound to an address and listening for connections.
@@ -2231,7 +2236,7 @@ cdef class Loop:
22312236 fut, sock)
22322237
22332238 self ._add_reader(sock, handle)
2234- return fut
2239+ return await fut
22352240
22362241 @cython.iterable_coroutine
22372242 async def sock_connect(self , sock, address):
@@ -2390,9 +2395,10 @@ cdef class Loop:
23902395
23912396 return proc, protocol
23922397
2393- def subprocess_shell (self , protocol_factory , cmd , *,
2394- shell = True ,
2395- **kwargs ):
2398+ @cython.iterable_coroutine
2399+ async def subprocess_shell(self , protocol_factory, cmd, * ,
2400+ shell = True ,
2401+ ** kwargs):
23962402
23972403 if not shell:
23982404 raise ValueError (" shell must be True" )
@@ -2401,19 +2407,20 @@ cdef class Loop:
24012407 if shell:
24022408 args = [b' /bin/sh' , b' -c' ] + args
24032409
2404- return self .__subprocess_run(protocol_factory, args, shell = True ,
2405- ** kwargs)
2410+ return await self .__subprocess_run(protocol_factory, args, shell = True ,
2411+ ** kwargs)
24062412
2407- def subprocess_exec (self , protocol_factory , program , *args ,
2408- shell = False , **kwargs ):
2413+ @cython.iterable_coroutine
2414+ async def subprocess_exec(self , protocol_factory, program, * args,
2415+ shell = False , ** kwargs):
24092416
24102417 if shell:
24112418 raise ValueError (" shell must be False" )
24122419
24132420 args = list ((program,) + args)
24142421
2415- return self .__subprocess_run(protocol_factory, args, shell = False ,
2416- ** kwargs)
2422+ return await self .__subprocess_run(protocol_factory, args, shell = False ,
2423+ ** kwargs)
24172424
24182425 @cython.iterable_coroutine
24192426 async def connect_read_pipe(self , proto_factory, pipe):
0 commit comments