bpo-42756: Configure LMTP Unix-domain socket to use global default timeout when timeout not provided (GH-23969)

This commit is contained in:
Ross 2021-01-01 17:20:25 +00:00 committed by GitHub
parent de6f20a6de
commit 3bf05327c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 1 deletions

View file

@ -1082,7 +1082,8 @@ class LMTP(SMTP):
# Handle Unix-domain sockets.
try:
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.sock.settimeout(self.timeout)
if self.timeout is not socket._GLOBAL_DEFAULT_TIMEOUT:
self.sock.settimeout(self.timeout)
self.file = None
self.sock.connect(host)
except OSError: