Skip to content

Commit 62e430a

Browse files
miss-islingtonAA-Turnerserhiy-storchaka
authored
[3.11] GH-101100: Fix reference warnings for socket methods (GH-110114) (#112456)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent faa1ef4 commit 62e430a

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

Doc/library/socket.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ all modern Unix systems, Windows, MacOS, and probably additional platforms.
2323

2424
The Python interface is a straightforward transliteration of the Unix system
2525
call and library interface for sockets to Python's object-oriented style: the
26-
:func:`.socket` function returns a :dfn:`socket object` whose methods implement
26+
:func:`~socket.socket` function returns a :dfn:`socket object` whose methods implement
2727
the various socket system calls. Parameter types are somewhat higher-level than
2828
in the C interface: as with :meth:`read` and :meth:`write` operations on Python
2929
files, buffer allocation on receive operations is automatic, and buffer length
@@ -322,7 +322,7 @@ Constants
322322
AF_INET6
323323

324324
These constants represent the address (and protocol) families, used for the
325-
first argument to :func:`.socket`. If the :const:`AF_UNIX` constant is not
325+
first argument to :func:`~socket.socket`. If the :const:`AF_UNIX` constant is not
326326
defined then this protocol is unsupported. More constants may be available
327327
depending on the system.
328328

@@ -339,7 +339,7 @@ Constants
339339
SOCK_SEQPACKET
340340

341341
These constants represent the socket types, used for the second argument to
342-
:func:`.socket`. More constants may be available depending on the system.
342+
:func:`~socket.socket`. More constants may be available depending on the system.
343343
(Only :const:`SOCK_STREAM` and :const:`SOCK_DGRAM` appear to be generally
344344
useful.)
345345

@@ -378,7 +378,7 @@ Constants
378378

379379
Many constants of these forms, documented in the Unix documentation on sockets
380380
and/or the IP protocol, are also defined in the socket module. They are
381-
generally used in arguments to the :meth:`setsockopt` and :meth:`getsockopt`
381+
generally used in arguments to the :meth:`~socket.setsockopt` and :meth:`~socket.getsockopt`
382382
methods of socket objects. In most cases, only those symbols that are defined
383383
in the Unix header files are defined; for a few symbols, default values are
384384
provided.
@@ -671,7 +671,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.
671671

672672
Build a pair of connected socket objects using the given address family, socket
673673
type, and protocol number. Address family, socket type, and protocol number are
674-
as for the :func:`.socket` function above. The default family is :const:`AF_UNIX`
674+
as for the :func:`~socket.socket` function above. The default family is :const:`AF_UNIX`
675675
if defined on the platform; otherwise, the default is :const:`AF_INET`.
676676

677677
The newly created sockets are :ref:`non-inheritable <fd_inheritance>`.
@@ -767,7 +767,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.
767767

768768
Duplicate the file descriptor *fd* (an integer as returned by a file object's
769769
:meth:`~io.IOBase.fileno` method) and build a socket object from the result. Address
770-
family, socket type and protocol number are as for the :func:`.socket` function
770+
family, socket type and protocol number are as for the :func:`~socket.socket` function
771771
above. The file descriptor should refer to a socket, but this is not checked ---
772772
subsequent operations on the object may fail if the file descriptor is invalid.
773773
This function is rarely needed, but can be used to get or set socket options on
@@ -832,7 +832,7 @@ The :mod:`socket` module also offers various network-related services:
832832
``(family, type, proto, canonname, sockaddr)``
833833

834834
In these tuples, *family*, *type*, *proto* are all integers and are
835-
meant to be passed to the :func:`.socket` function. *canonname* will be
835+
meant to be passed to the :func:`~socket.socket` function. *canonname* will be
836836
a string representing the canonical name of the *host* if
837837
:const:`AI_CANONNAME` is part of the *flags* argument; else *canonname*
838838
will be empty. *sockaddr* is a tuple describing a socket address, whose
@@ -948,7 +948,7 @@ The :mod:`socket` module also offers various network-related services:
948948
.. function:: getprotobyname(protocolname)
949949

950950
Translate an internet protocol name (for example, ``'icmp'``) to a constant
951-
suitable for passing as the (optional) third argument to the :func:`.socket`
951+
suitable for passing as the (optional) third argument to the :func:`~socket.socket`
952952
function. This is usually only needed for sockets opened in "raw" mode
953953
(:const:`SOCK_RAW`); for the normal socket modes, the correct protocol is chosen
954954
automatically if the protocol is omitted or zero.
@@ -1232,7 +1232,7 @@ The :mod:`socket` module also offers various network-related services:
12321232

12331233
Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket *sock*.
12341234
The *fds* parameter is a sequence of file descriptors.
1235-
Consult :meth:`sendmsg` for the documentation of these parameters.
1235+
Consult :meth:`~socket.sendmsg` for the documentation of these parameters.
12361236

12371237
.. availability:: Unix, Windows, not Emscripten, not WASI.
12381238

@@ -1246,7 +1246,7 @@ The :mod:`socket` module also offers various network-related services:
12461246

12471247
Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket *sock*.
12481248
Return ``(msg, list(fds), flags, addr)``.
1249-
Consult :meth:`recvmsg` for the documentation of these parameters.
1249+
Consult :meth:`~socket.recvmsg` for the documentation of these parameters.
12501250

12511251
.. availability:: Unix, Windows, not Emscripten, not WASI.
12521252

@@ -1965,10 +1965,10 @@ Example
19651965

19661966
Here are four minimal example programs using the TCP/IP protocol: a server that
19671967
echoes all data that it receives back (servicing only one client), and a client
1968-
using it. Note that a server must perform the sequence :func:`.socket`,
1968+
using it. Note that a server must perform the sequence :func:`~socket.socket`,
19691969
:meth:`~socket.bind`, :meth:`~socket.listen`, :meth:`~socket.accept` (possibly
19701970
repeating the :meth:`~socket.accept` to service more than one client), while a
1971-
client only needs the sequence :func:`.socket`, :meth:`~socket.connect`. Also
1971+
client only needs the sequence :func:`~socket.socket`, :meth:`~socket.connect`. Also
19721972
note that the server does not :meth:`~socket.sendall`/:meth:`~socket.recv` on
19731973
the socket it is listening on but on the new socket returned by
19741974
:meth:`~socket.accept`.

Doc/whatsnew/2.0.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -671,9 +671,9 @@ errors. If you absolutely must use 2.0 but can't fix your code, you can edit
671671
``NO_STRICT_LIST_APPEND`` to preserve the old behaviour; this isn't recommended.
672672

673673
Some of the functions in the :mod:`socket` module are still forgiving in this
674-
way. For example, :func:`socket.connect( ('hostname', 25) )` is the correct
675-
form, passing a tuple representing an IP address, but :func:`socket.connect(
676-
'hostname', 25 )` also works. :func:`socket.connect_ex` and :func:`socket.bind`
674+
way. For example, ``socket.connect( ('hostname', 25) )`` is the correct
675+
form, passing a tuple representing an IP address, but ``socket.connect('hostname', 25)``
676+
also works. :meth:`socket.connect_ex <socket.socket.connect_ex>` and :meth:`socket.bind <socket.socket.bind>`
677677
are similarly easy-going. 2.0alpha1 tightened these functions up, but because
678678
the documentation actually used the erroneous multiple argument form, many
679679
people wrote code which would break with the stricter checking. GvR backed out

Doc/whatsnew/2.7.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -2382,8 +2382,8 @@ Port-Specific Changes: Mac OS X
23822382
Port-Specific Changes: FreeBSD
23832383
-----------------------------------
23842384

2385-
* FreeBSD 7.1's :const:`SO_SETFIB` constant, used with
2386-
:func:`~socket.getsockopt`/:func:`~socket.setsockopt` to select an
2385+
* FreeBSD 7.1's :const:`SO_SETFIB` constant, used with the :func:`~socket.socket` methods
2386+
:func:`~socket.socket.getsockopt`/:func:`~socket.socket.setsockopt` to select an
23872387
alternate routing table, is now available in the :mod:`socket`
23882388
module. (Added by Kyle VanderBeek; :issue:`8235`.)
23892389

0 commit comments

Comments
 (0)