bpo-15999: Always pass bool instead of int to socket.setblocking(). (GH-15621)

This commit is contained in:
Serhiy Storchaka 2019-09-01 12:12:52 +03:00 committed by GitHub
parent eb8974616b
commit 5eca7f3f38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 18 deletions

View file

@ -4597,7 +4597,7 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest):
def testAccept(self):
# Testing non-blocking accept
self.serv.setblocking(0)
self.serv.setblocking(False)
# connect() didn't start: non-blocking accept() fails
start_time = time.monotonic()
@ -4628,7 +4628,7 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest):
# Testing non-blocking recv
conn, addr = self.serv.accept()
self.addCleanup(conn.close)
conn.setblocking(0)
conn.setblocking(False)
# the server didn't send data yet: non-blocking recv() fails
with self.assertRaises(BlockingIOError):
@ -5698,15 +5698,15 @@ class NonblockConstantTest(unittest.TestCase):
with socket.socket(socket.AF_INET,
socket.SOCK_STREAM | socket.SOCK_NONBLOCK) as s:
self.checkNonblock(s)
s.setblocking(1)
s.setblocking(True)
self.checkNonblock(s, nonblock=False)
s.setblocking(0)
s.setblocking(False)
self.checkNonblock(s)
s.settimeout(None)
self.checkNonblock(s, nonblock=False)
s.settimeout(2.0)
self.checkNonblock(s, timeout=2.0)
s.setblocking(1)
s.setblocking(True)
self.checkNonblock(s, nonblock=False)
# defaulttimeout
t = socket.getdefaulttimeout()