mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
asyncio/tests: Fix some ResourceWarnings
This commit is contained in:
parent
aa78adc589
commit
5f68ca66bf
2 changed files with 18 additions and 13 deletions
|
@ -647,12 +647,13 @@ os.close(fd)
|
|||
def server():
|
||||
# Runs in a separate thread.
|
||||
sock = socket.socket()
|
||||
sock.bind(('localhost', 0))
|
||||
sock.listen(1)
|
||||
addr = sock.getsockname()
|
||||
q.put(addr)
|
||||
clt, _ = sock.accept()
|
||||
clt.close()
|
||||
with sock:
|
||||
sock.bind(('localhost', 0))
|
||||
sock.listen(1)
|
||||
addr = sock.getsockname()
|
||||
q.put(addr)
|
||||
clt, _ = sock.accept()
|
||||
clt.close()
|
||||
|
||||
@asyncio.coroutine
|
||||
def client(host, port):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue