Fixed the semantic of timeout for socket.create_connection and
all the upper level libraries that use it, including urllib2.
Added and fixed some tests, and changed docs correspondingly.
Thanks to John J Lee for the patch and the pusing, :)
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index 5ac9fc3..afa38bc 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -220,7 +220,8 @@
ehlo_resp = None
does_esmtp = 0
- def __init__(self, host='', port=0, local_hostname=None, timeout=None):
+ def __init__(self, host='', port=0, local_hostname=None,
+ timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
"""Initialize a new instance.
If specified, `host' is the name of the remote host to which to
@@ -741,7 +742,8 @@
certificate chain file for the SSL connection.
"""
def __init__(self, host='', port=0, local_hostname=None,
- keyfile=None, certfile=None, timeout=None):
+ keyfile=None, certfile=None,
+ timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
self.keyfile = keyfile
self.certfile = certfile
SMTP.__init__(self, host, port, local_hostname, timeout)