summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-10-24 20:07:28 -0700
committerBenjamin Peterson <benjamin@python.org>2015-10-24 20:07:28 -0700
commit2374ad7dd90218f36144224dd2a78bbe1d739f5c (patch)
treedbf2501e79d1cd44636621bb0d6358a0bfdd044d
parentb75e7f52698ff85b438ac3c8241b7b867213c99b (diff)
parent2775d85d55a092e3aca9a72bf2e5328d95b0340f (diff)
downloadcpython-git-2374ad7dd90218f36144224dd2a78bbe1d739f5c.tar.gz
merge 3.5 (#25471)
-rw-r--r--Lib/socket.py6
-rw-r--r--Lib/test/test_socket.py1
-rw-r--r--Misc/NEWS3
3 files changed, 9 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index db34ab37ee..ed1b10a254 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 17819f2fd1..63cc284eb3 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.")
diff --git a/Misc/NEWS b/Misc/NEWS
index 6196671ba7..25845b06f3 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -190,6 +190,9 @@ Library
- Issue #13248: Remove deprecated inspect.getargspec and inspect.getmoduleinfo
functions.
+- Issue #25471: Sockets returned from accept() shouldn't appear to be
+ nonblocking.
+
- Issue #25319: When threading.Event is reinitialized, the underlying condition
should use a regular lock rather than a recursive lock.