From 8931e9f794356f4d4772344b26dc09ae5e5e8f2f Mon Sep 17 00:00:00 2001 From: Sergey Shepelev Date: Mon, 24 Nov 2014 03:49:06 +0300 Subject: [PATCH] tpool: Windows compatibility, fix ResourceWarning. Thanks to Victor Stinner https://github.com/eventlet/eventlet/pull/167 Signal socket bind to 127.0.0.1, '' does not work on Windows sock.close() to fix ResourceWarning with python3 -Wd --- eventlet/tpool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eventlet/tpool.py b/eventlet/tpool.py index 552f312..e7f0db1 100644 --- a/eventlet/tpool.py +++ b/eventlet/tpool.py @@ -257,11 +257,12 @@ def setup(): _setup_already = True sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.bind(('', 0)) + sock.bind(('127.0.0.1', 0)) sock.listen(1) csock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) csock.connect(sock.getsockname()) _wsock, _addr = sock.accept() + sock.close() _rsock = greenio.GreenSocket(csock) _reqq = Queue(maxsize=-1)