Skip to content

Commit 0ad690a

Browse files
committed
gh-89554: Document socket.SocketType as a class and fix its description
socket.SocketType is a class (re-exported from _socket as an alias of _socket.socket, the base class of socket.socket), but was documented with the ".. data::" directive, so ":class:" cross-references to it cannot resolve against a py:class target. Switch the entry to ".. class::", and correct the description: SocketType is the base class of the socket type, not "type(socket(...))" (which is socket.socket). This addresses the misleading wording reported in gh-88427.
1 parent 2f8f569 commit 0ad690a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Doc/library/socket.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,10 +1025,12 @@ The following functions all create :ref:`socket objects <socket-objects>`.
10251025
.. versionadded:: 3.3
10261026

10271027

1028-
.. data:: SocketType
1028+
.. class:: SocketType
10291029

1030-
This is a Python type object that represents the socket object type. It is the
1031-
same as ``type(socket(...))``.
1030+
The base class of the :class:`~socket.socket` type, re-exported from
1031+
:mod:`!_socket`. An instance check such as
1032+
``isinstance(socket(...), SocketType)`` is true, but ``SocketType`` is not
1033+
the same as ``type(socket(...))``, which is :class:`~socket.socket` itself.
10321034

10331035

10341036
Other functions

0 commit comments

Comments
 (0)