diff options
author | Yury Selivanov <yury@magic.io> | 2017-12-19 01:02:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-19 01:02:54 (GMT) |
commit | 9818142b1bd20243733a953fb8aa2c7be314c47c (patch) | |
tree | 625350fae6c199ae5442118eaf36db480fe00046 /Doc/library | |
parent | 6efcb6d3d5911aaf699f9df3bb3bc26e94f38e6d (diff) | |
download | cpython-9818142b1bd20243733a953fb8aa2c7be314c47c.zip cpython-9818142b1bd20243733a953fb8aa2c7be314c47c.tar.gz cpython-9818142b1bd20243733a953fb8aa2c7be314c47c.tar.bz2 |
bpo-32331: Fix socket.type when SOCK_NONBLOCK is available (#4877)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/socket.rst | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index 42fd7ea..db032ca 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -482,6 +482,20 @@ The following functions all create :ref:`socket objects <socket-objects>`. .. versionchanged:: 3.7 The CAN_ISOTP protocol was added. + .. versionchanged:: 3.7 + When :const:`SOCK_NONBLOCK` or :const:`SOCK_CLOEXEC` + bit flags are applied to *type* they are cleared, and + :attr:`socket.type` will not reflect them. They are still passed + to the underlying system `socket()` call. Therefore:: + + sock = socket.socket( + socket.AF_INET, + socket.SOCK_STREAM | socket.SOCK_NONBLOCK) + + will still create a non-blocking socket on OSes that support + ``SOCK_NONBLOCK``, but ``sock.type`` will be set to + ``socket.SOCK_STREAM``. + .. function:: socketpair([family[, type[, proto]]]) Build a pair of connected socket objects using the given address family, socket @@ -1417,6 +1431,10 @@ to sockets. * ``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)`` + .. versionchanged:: 3.7 + The method no longer applies :const:`SOCK_NONBLOCK` flag on + :attr:`socket.type`. + .. method:: socket.settimeout(value) @@ -1429,6 +1447,10 @@ to sockets. For further information, please consult the :ref:`notes on socket timeouts <socket-timeouts>`. + .. versionchanged:: 3.7 + The method no longer toggles :const:`SOCK_NONBLOCK` flag on + :attr:`socket.type`. + .. method:: socket.setsockopt(level, optname, value: int) .. method:: socket.setsockopt(level, optname, value: buffer) |