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.

Title: SSL timeouts should raise socket.timeout, not a generic SSLError
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pitrou
Priority: normal Keywords:

Created on 2010-10-31 21:43 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg120090 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-10-31 21:43
The issue here is that ssl is using its own exception class rather than the socket module's "timeout" class:

test test_httplib failed -- Traceback (most recent call last):
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/test/", line 408, in test_networked
    h.request('GET', '/')
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/", line 943, in request
    self._send_request(method, url, body, headers)
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/", line 981, in _send_request
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/", line 939, in endheaders
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/", line 791, in _send_output
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/", line 737, in send
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/", line 1086, in connect
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/", line 168, in wrap_socket
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/", line 254, in __init__
    raise x
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/", line 250, in __init__
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/", line 429, in do_handshake
ssl.SSLError: _ssl.c:374: The handshake operation timed out
msg123287 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-12-03 19:57
Requalifying this issue so that the ssl module is fixed to raise socket.timeout on socket timeouts, which is not only more logical but much more useful (since you can then specifically handle this error).
msg123288 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-12-03 20:00
Committed in r86997. I won't backport it to bugfix branches since it is a small compatibility breach.
Date User Action Args
2022-04-11 14:57:08adminsetgithub: 54481
2010-12-03 20:00:10pitrousetstatus: open -> closed
resolution: fixed
messages: + msg123288

stage: resolved
2010-12-03 19:57:16pitrousetpriority: low -> normal

title: SSL handshake timeouts not caught by transient_internet -> SSL timeouts should raise socket.timeout, not a generic SSLError
messages: + msg123287
versions: - Python 3.1, Python 2.7
2010-10-31 21:43:51pitroucreate