changeset: 98855:347221cfa224 parent: 98852:1216494acffe parent: 98854:7577960ea17b user: Benjamin Peterson date: Sat Oct 24 20:07:28 2015 -0700 files: Misc/NEWS description: merge 3.5 (#25471) diff -r 1216494acffe -r 347221cfa224 Lib/socket.py --- a/Lib/socket.py Sat Oct 24 17:43:28 2015 +0300 +++ b/Lib/socket.py Sat Oct 24 20:07:28 2015 -0700 @@ -193,7 +193,11 @@ 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 -r 1216494acffe -r 347221cfa224 Lib/test/test_socket.py --- a/Lib/test/test_socket.py Sat Oct 24 17:43:28 2015 +0300 +++ b/Lib/test/test_socket.py Sat Oct 24 20:07:28 2015 -0700 @@ -3866,6 +3866,7 @@ 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 -r 1216494acffe -r 347221cfa224 Misc/NEWS --- a/Misc/NEWS Sat Oct 24 17:43:28 2015 +0300 +++ b/Misc/NEWS Sat Oct 24 20:07:28 2015 -0700 @@ -190,6 +190,9 @@ - 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.