This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Chris.Clark
Recipients Chris.Clark
Date 2014-03-12.22:52:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1394664754.18.0.260499838693.issue20903@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation for smtplib.SMTP says "If the connect() call returns anything other than a success code, an SMTPConnectError is raised." It doesn't explicitly specify what happens when connect() raises instead of returns, but I think either the documentation should mention "socket.timeout" or it should raise SMTPConnectError.


Python 3.3.4 (default, Feb 11 2014, 15:56:08) 
[GCC 4.8.2 20140206 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from smtplib import SMTP
>>> SMTP('a.com', timeout=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.3/smtplib.py", line 241, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.3/smtplib.py", line 320, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python3.3/smtplib.py", line 291, in _get_socket
    self.source_address)
  File "/usr/lib/python3.3/socket.py", line 435, in create_connection
    raise err
  File "/usr/lib/python3.3/socket.py", line 426, in create_connection
    sock.connect(sa)
socket.timeout: timed out
History
Date User Action Args
2014-03-12 22:52:34Chris.Clarksetrecipients: + Chris.Clark
2014-03-12 22:52:34Chris.Clarksetmessageid: <1394664754.18.0.260499838693.issue20903@psf.upfronthosting.co.za>
2014-03-12 22:52:34Chris.Clarklinkissue20903 messages
2014-03-12 22:52:33Chris.Clarkcreate