From 0e389aea8e098493667660bc8df77d77ed897c54 Mon Sep 17 00:00:00 2001 From: Jade Date: Fri, 11 Sep 2026 16:56:15 +0900 Subject: [PATCH] gh-115426: Fix the socket object close() cross-references The three :meth:`socket.close` references in the socket object section resolved to the module-level socket.close(fd) function instead of the socket object's close() method. close is the only name that is both a module-level function and a socket method, so the Python domain matched . first; every other method reference on the page resolves correctly. Qualifying the target as socket.socket.close, as the neighbouring ioctl and shutdown references already do, points them at the method. --- Doc/library/socket.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index fb9249df4be33e..054ccc556740c2 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -1497,7 +1497,7 @@ Socket Objects of :meth:`socket.getpeername` but not the actual OS resource. Unlike :func:`socket.fromfd`, *fileno* will return the same socket and not a duplicate. This may help close a detached socket using - :meth:`socket.close`. + :meth:`~socket.socket.close`. The newly created socket is :ref:`non-inheritable `. @@ -1544,7 +1544,7 @@ Socket Objects .. versionchanged:: 3.2 Support for the :term:`context manager` protocol was added. Exiting the - context manager is equivalent to calling :meth:`~socket.close`. + context manager is equivalent to calling :meth:`~socket.socket.close`. .. method:: accept() @@ -1769,7 +1769,7 @@ Socket Objects Closing the file object returned by :meth:`makefile` won't close the original socket unless all other file objects have been closed and - :meth:`socket.close` has been called on the socket object. + :meth:`~socket.socket.close` has been called on the socket object. .. note::