Skip to content

Commit a2ed553

Browse files
miss-islingtonAA-Turnerserhiy-storchaka
authored
[3.12] GH-101100: Fix reference warnings for socket methods (GH-110114) (#112455)
Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent a826962 commit a2ed553

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

Doc/library/socket.rst

Lines changed: 12 additions & 12 deletions
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
@@ -348,7 +348,7 @@ Constants
348348
AF_INET6
349349

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

@@ -365,7 +365,7 @@ Constants
365365
SOCK_SEQPACKET
366366

367367
These constants represent the socket types, used for the second argument to
368-
:func:`.socket`. More constants may be available depending on the system.
368+
:func:`~socket.socket`. More constants may be available depending on the system.
369369
(Only :const:`SOCK_STREAM` and :const:`SOCK_DGRAM` appear to be generally
370370
useful.)
371371

@@ -404,7 +404,7 @@ Constants
404404

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

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

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

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

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

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

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

13361336
.. availability:: Unix, Windows, not Emscripten, not WASI.
13371337

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

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

13501350
.. availability:: Unix, Windows, not Emscripten, not WASI.
13511351

@@ -2064,10 +2064,10 @@ Example
20642064

20652065
Here are four minimal example programs using the TCP/IP protocol: a server that
20662066
echoes all data that it receives back (servicing only one client), and a client
2067-
using it. Note that a server must perform the sequence :func:`.socket`,
2067+
using it. Note that a server must perform the sequence :func:`~socket.socket`,
20682068
:meth:`~socket.bind`, :meth:`~socket.listen`, :meth:`~socket.accept` (possibly
20692069
repeating the :meth:`~socket.accept` to service more than one client), while a
2070-
client only needs the sequence :func:`.socket`, :meth:`~socket.connect`. Also
2070+
client only needs the sequence :func:`~socket.socket`, :meth:`~socket.connect`. Also
20712071
note that the server does not :meth:`~socket.sendall`/:meth:`~socket.recv` on
20722072
the socket it is listening on but on the new socket returned by
20732073
:meth:`~socket.accept`.

Doc/whatsnew/2.0.rst

Lines changed: 3 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,8 +2383,8 @@ Port-Specific Changes: Mac OS X
23832383
Port-Specific Changes: FreeBSD
23842384
-----------------------------------
23852385

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

0 commit comments

Comments
 (0)