mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
bpo-32331: Fix socket.type when SOCK_NONBLOCK is available (#4877)
This commit is contained in:
parent
6efcb6d3d5
commit
9818142b1b
7 changed files with 87 additions and 24 deletions
|
@ -726,14 +726,10 @@ class BaseTestAPI:
|
|||
def test_create_socket(self):
|
||||
s = asyncore.dispatcher()
|
||||
s.create_socket(self.family)
|
||||
self.assertEqual(s.socket.type, socket.SOCK_STREAM)
|
||||
self.assertEqual(s.socket.family, self.family)
|
||||
SOCK_NONBLOCK = getattr(socket, 'SOCK_NONBLOCK', 0)
|
||||
sock_type = socket.SOCK_STREAM | SOCK_NONBLOCK
|
||||
if hasattr(socket, 'SOCK_CLOEXEC'):
|
||||
self.assertIn(s.socket.type,
|
||||
(sock_type | socket.SOCK_CLOEXEC, sock_type))
|
||||
else:
|
||||
self.assertEqual(s.socket.type, sock_type)
|
||||
self.assertEqual(s.socket.gettimeout(), 0)
|
||||
self.assertFalse(s.socket.get_inheritable())
|
||||
|
||||
def test_bind(self):
|
||||
if HAS_UNIX_SOCKETS and self.family == socket.AF_UNIX:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue