summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-10-25 03:07:08 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-10-25 03:07:08 (GMT)
commit2775d85d55a092e3aca9a72bf2e5328d95b0340f (patch)
tree573fbdfbdf1f2eebe412d73b8193b315777d8214 /Lib
parent0a467d1b8613edfff9f608da8622c716c882ac00 (diff)
parentd9dbf493837b798757ed68dbd97dd55cd0c6efa5 (diff)
downloadcpython-2775d85d55a092e3aca9a72bf2e5328d95b0340f.zip
cpython-2775d85d55a092e3aca9a72bf2e5328d95b0340f.tar.gz
cpython-2775d85d55a092e3aca9a72bf2e5328d95b0340f.tar.bz2
merge 3.4 (#25471)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/socket.py6
-rw-r--r--Lib/test/test_socket.py1
2 files changed, 6 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index db34ab3..ed1b10a 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -193,7 +193,11 @@ class socket(_socket.socket):
For IP sockets, the address info is a pair (hostaddr, port).
"""
fd, addr = self._accept()
- sock = socket(self.family, self.type, self.proto, fileno=fd)
+ # If our type has the SOCK_NONBLOCK flag, we shouldn't pass it onto the
+ # new socket. We do not currently allow passing SOCK_NONBLOCK to
+ # accept4, so the returned socket is always blocking.
+ type = self.type & ~globals().get("SOCK_NONBLOCK", 0)
+ sock = socket(self.family, 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.
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 17819f2..63cc284 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -3866,6 +3866,7 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest):
read, write, err = select.select([self.serv], [], [])
if self.serv in read:
conn, addr = self.serv.accept()
+ self.assertIsNone(conn.gettimeout())
conn.close()
else:
self.fail("Error trying to do accept after select.")