summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 2e51cd1..0dd8ec7 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -745,7 +745,7 @@ def has_dualstack_ipv6():
return False
-def create_server(address, *, family=AF_INET, backlog=0, reuse_port=False,
+def create_server(address, *, family=AF_INET, backlog=None, reuse_port=False,
dualstack_ipv6=False):
"""Convenience function which creates a SOCK_STREAM type socket
bound to *address* (a 2-tuple (host, port)) and return the socket
@@ -804,7 +804,10 @@ def create_server(address, *, family=AF_INET, backlog=0, reuse_port=False,
msg = '%s (while attempting to bind on address %r)' % \
(err.strerror, address)
raise error(err.errno, msg) from None
- sock.listen(backlog)
+ if backlog is None:
+ sock.listen()
+ else:
+ sock.listen(backlog)
return sock
except error:
sock.close()