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 christian.heimes
Recipients alex, christian.heimes, corona10, dstufft, janssen, vstinner
Date 2020-11-19.19:10:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The socket module has a custom timeout exception "socket.timeout". The exception is documented as :

> A subclass of OSError, this exception is raised when a timeout occurs on a socket which has had timeouts enabled via a prior call to settimeout() (or implicitly through setdefaulttimeout()).

It's a distinct exception type and not the same as the global TimeoutError.

>>> import socket
>>> socket.timeout == TimeoutError

I like to follow the example of the deprecated "socket.error", replace the custom exception and make it an alias of TimeoutError. The risk is minimal. Both exceptions are subclasses of OSError.

The change would not only make exception handling more consistent. It would also allow me to simplify some code in ssl and socket C code. I might even be able to remove the socket CAPI import from _ssl.c completely.
Date User Action Args
2020-11-19 19:10:42christian.heimessetrecipients: + christian.heimes, janssen, vstinner, alex, dstufft, corona10
2020-11-19 19:10:42christian.heimessetmessageid: <>
2020-11-19 19:10:42christian.heimeslinkissue42413 messages
2020-11-19 19:10:42christian.heimescreate