summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorCharles-François Natali <cf.natali@gmail.com>2014-05-22 18:45:39 (GMT)
committerCharles-François Natali <cf.natali@gmail.com>2014-05-22 18:45:39 (GMT)
commit644b8f52a81cf5d9d8ae263a82541b738872ca46 (patch)
treee043a45917b9d6a0ab5acf582bf0b0e412f9aad7 /Lib/test/test_socket.py
parent2b00c4999d6d1b517d6b382d6b584b34c0834d32 (diff)
downloadcpython-644b8f52a81cf5d9d8ae263a82541b738872ca46.zip
cpython-644b8f52a81cf5d9d8ae263a82541b738872ca46.tar.gz
cpython-644b8f52a81cf5d9d8ae263a82541b738872ca46.tar.bz2
Issue #21455: Add a default backlog to socket.listen().
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index aed10a7..86cbec7 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -1344,10 +1344,13 @@ class GeneralModuleTests(unittest.TestCase):
def test_listen_backlog(self):
for backlog in 0, -1:
- srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as srv:
+ srv.bind((HOST, 0))
+ srv.listen(backlog)
+
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as srv:
srv.bind((HOST, 0))
- srv.listen(backlog)
- srv.close()
+ srv.listen()
@support.cpython_only
def test_listen_backlog_overflow(self):