]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix host in address of socket.create_server example. (GH-17706)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 11 Jan 2020 05:39:01 +0000 (21:39 -0800)
committerGitHub <noreply@github.com>
Sat, 11 Jan 2020 05:39:01 +0000 (21:39 -0800)
Host as None in address raises TypeError since it should be string, bytes or bytearray.
(cherry picked from commit 43682f1e39a3c61f0e8a638b887bcdcbfef766c5)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Lib/socket.py

index 5b17906ef479a12ebaddfa4696fc9b3adc464c1b..f83f36d0ada55c71dc9397709153c06298b7c0cf 100644 (file)
@@ -843,7 +843,7 @@ def create_server(address, *, family=AF_INET, backlog=None, reuse_port=False,
     connections. When false it will explicitly disable this option on
     platforms that enable it by default (e.g. Linux).
 
-    >>> with create_server((None, 8000)) as server:
+    >>> with create_server(('', 8000)) as server:
     ...     while True:
     ...         conn, addr = server.accept()
     ...         # handle new connection