@@ -1363,17 +1363,19 @@ cdef class Loop:
1363
1363
1364
1364
return future.result()
1365
1365
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 ):
1368
1369
1369
1370
addr = __static_getaddrinfo_pyaddr(host, port, family,
1370
1371
type , proto, flags)
1371
1372
if addr is not None :
1372
1373
fut = self ._new_future()
1373
1374
fut.set_result([addr])
1374
- return fut
1375
+ return await fut
1375
1376
1376
- return self ._getaddrinfo(host, port, family, type , proto, flags, 1 )
1377
+ return await self ._getaddrinfo(
1378
+ host, port, family, type , proto, flags, 1 )
1377
1379
1378
1380
@cython.iterable_coroutine
1379
1381
async def getnameinfo(self , sockaddr, int flags = 0 ):
@@ -2102,7 +2104,8 @@ cdef class Loop:
2102
2104
""" Remove a writer callback."""
2103
2105
self ._remove_writer(fileobj)
2104
2106
2105
- def sock_recv (self , sock , n ):
2107
+ @cython.iterable_coroutine
2108
+ async def sock_recv(self , sock, n):
2106
2109
""" Receive data from the socket.
2107
2110
2108
2111
The return value is a bytes object representing the data received.
@@ -2126,9 +2129,10 @@ cdef class Loop:
2126
2129
fut, sock, n)
2127
2130
2128
2131
self ._add_reader(sock, handle)
2129
- return fut
2132
+ return await fut
2130
2133
2131
- def sock_recv_into (self , sock , buf ):
2134
+ @cython.iterable_coroutine
2135
+ async def sock_recv_into(self , sock, buf):
2132
2136
""" Receive data from the socket.
2133
2137
2134
2138
The received data is written into *buf* (a writable buffer).
@@ -2151,7 +2155,7 @@ cdef class Loop:
2151
2155
fut, sock, buf)
2152
2156
2153
2157
self ._add_reader(sock, handle)
2154
- return fut
2158
+ return await fut
2155
2159
2156
2160
@cython.iterable_coroutine
2157
2161
async def sock_sendall(self , sock, data):
@@ -2206,7 +2210,8 @@ cdef class Loop:
2206
2210
finally :
2207
2211
socket_dec_io_ref(sock)
2208
2212
2209
- def sock_accept (self , sock ):
2213
+ @cython.iterable_coroutine
2214
+ async def sock_accept(self , sock):
2210
2215
""" Accept a connection.
2211
2216
2212
2217
The socket must be bound to an address and listening for connections.
@@ -2231,7 +2236,7 @@ cdef class Loop:
2231
2236
fut, sock)
2232
2237
2233
2238
self ._add_reader(sock, handle)
2234
- return fut
2239
+ return await fut
2235
2240
2236
2241
@cython.iterable_coroutine
2237
2242
async def sock_connect(self , sock, address):
@@ -2390,9 +2395,10 @@ cdef class Loop:
2390
2395
2391
2396
return proc, protocol
2392
2397
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):
2396
2402
2397
2403
if not shell:
2398
2404
raise ValueError (" shell must be True" )
@@ -2401,19 +2407,20 @@ cdef class Loop:
2401
2407
if shell:
2402
2408
args = [b' /bin/sh' , b' -c' ] + args
2403
2409
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)
2406
2412
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):
2409
2416
2410
2417
if shell:
2411
2418
raise ValueError (" shell must be False" )
2412
2419
2413
2420
args = list ((program,) + args)
2414
2421
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)
2417
2424
2418
2425
@cython.iterable_coroutine
2419
2426
async def connect_read_pipe(self , proto_factory, pipe):
0 commit comments