Commit 6036e346 authored by Denis Bilenko's avatar Denis Bilenko

add a comment regarding exc_clear() in create_connection

parent 7d0cbfe3
......@@ -616,6 +616,10 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=N
return sock
except error:
err = sys.exc_info()[1]
# without exc_clear(), if connect() fails once, the socket is referenced by the frame in exc_info
# and the next bind() fails (see test__socket.TestCreateConnection)
# that does not happen with regular sockets though, because _socket.socket.connect() is a built-in.
# this is similar to "getnameinfo loses a reference" failure in test_socket.py
sys.exc_clear()
if sock is not None:
sock.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment