summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index d0da740..95901ae 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -130,7 +130,13 @@ class socket(_socket.socket):
For IP sockets, the address info is a pair (hostaddr, port).
"""
fd, addr = self._accept()
- return socket(self.family, self.type, self.proto, fileno=fd), addr
+ sock = socket(self.family, self.type, self.proto, fileno=fd)
+ # Issue #7995: if no default timeout is set and the listening
+ # socket had a (non-zero) timeout, force the new socket in blocking
+ # mode to override platform-specific socket flags inheritance.
+ if getdefaulttimeout() is None and self.gettimeout():
+ sock.setblocking(True)
+ return sock, addr
def makefile(self, mode="r", buffering=None, *,
encoding=None, errors=None, newline=None):