summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-03-28 15:46:16 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2019-03-28 15:46:16 +0100
commit5b491253e6952dfb1115ef43e13d1076cb5a5549 (patch)
tree95a0ead216d2449086c218e928513cecd4d48002
parente19b28f2bd89c047b12f6a8ffb1fe793834700d3 (diff)
downloadcpython-git-bind-socket.tar.gz
update doc (remove ref to activestate recipe)bind-socket
-rw-r--r--Doc/library/socket.rst16
-rw-r--r--Lib/socket.py2
-rw-r--r--Lib/test/support/__init__.py1
3 files changed, 8 insertions, 11 deletions
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 800058b1af..b4a07bd5d5 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -597,9 +597,8 @@ The following functions all create :ref:`socket objects <socket-objects>`.
.. function:: create_server(address, *, family=AF_INET, backlog=0, reuse_port=False, dualstack_ipv6=False)
- Convenience function which creates a :data:`SOCK_STREAM` type socket
- bound to *address* (a 2-tuple ``(host, port)``) and return the socket
- object.
+ Convenience function which creates a TCP socket bound to *address* (a 2-tuple
+ ``(host, port)``) and return the socket object.
*family* should be either :data:`AF_INET` or :data:`AF_INET6`.
*backlog* is the queue size passed to :meth:`socket.listen`; when ``0``
@@ -608,14 +607,13 @@ The following functions all create :ref:`socket objects <socket-objects>`.
If *dualstack_ipv6* is true and the platform supports it the socket will
be able to accept both IPv4 and IPv6 connections, else it will raise
- :exc:`ValueError`. Most POSIX platforms are supposed to support this option.
- When this option is enabled the address returned by :meth:`socket.getpeername`
- when an IPv4 connection occurs will be an IPv6 address represented as an
- IPv4-mapped IPv6 address.
+ :exc:`ValueError`. Most POSIX platforms and Windows are supposed to support
+ this functionality.
+ When this functionality is enabled the address returned by
+ :meth:`socket.getpeername` when an IPv4 connection occurs will be an IPv6
+ address represented as an IPv4-mapped IPv6 address.
If *dualstack_ipv6* is false it will explicitly disable this functionality
on platforms that enable it by default (e.g. Linux).
- For platforms not supporting this functionality natively you could use this
- `MultipleSocketsListener recipe <https://code.activestate.com/recipes/578504/>`__.
This parameter can be used in conjunction with :func:`has_dualstack_ipv6`:
::
diff --git a/Lib/socket.py b/Lib/socket.py
index 454691cc11..2e51cd16f3 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -777,7 +777,7 @@ def create_server(address, *, family=AF_INET, backlog=0, reuse_port=False,
# 1) It's unnecessary: bind() will succeed even in case of a
# previous closed socket on the same address and still in
# TIME_WAIT state.
- # 2) If set, another socket may be free to bind() on the same
+ # 2) If set, another socket is free to bind() on the same
# address, effectively preventing this one from accepting
# connections. Also, it may set the process in a state where
# it'll no longer respond to any signals or graceful kills.
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 792ad3e8fe..5bd15a2fea 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -2978,7 +2978,6 @@ def maybe_get_event_loop_policy():
"""Return the global event loop policy if one is set, else return None."""
return asyncio.events._event_loop_policy
-
# Helpers for testing hashing.
NHASHBITS = sys.hash_info.width # number of bits in hash() result
assert NHASHBITS in (32, 64)