FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-89554: Document socket.SocketType as a class by gaborbernat · Pull Request #150683 · python/cpython · GitHub

Repository navigation

gh-89554: Document socket.SocketType as a class - #150683

Merged
vstinner merged 7 commits into
python:mainfrom
gaborbernat:gh-89554-socket-class-roles
Jun 10, 2026
Merged

vstinner merged 7 commits into
python:mainfrom
gaborbernat:gh-89554-socket-class-roles

Conversation

gaborbernat commented May 31, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor

socket.SocketType is a class, but the documentation marks it with the .. data:: directive, so :class: cross-references to it cannot resolve against a py:class target.

This switches the entry to .. class::. It also corrects the description: SocketType is re-exported from _socket as an alias of _socket.socket, the base class of socket.socket, so isinstance(socket(...), SocketType) is true while type(socket(...)) is socket.socket itself. The current wording, "the same as type(socket(...))", is the misleading text reported in gh-88427.

This overlaps with #93288, which corrects the same sentence but keeps .. data::. This PR combines that wording fix with the role fix.

Refs: gh-89554, gh-88427. Documentation-only change, so no Misc/NEWS entry (skip news).

This file is not covered by CODEOWNERS, so cc @vstinner, who reviews most socket changes.

Copy link
Copy Markdown
Contributor Author

For context, I am aware of gh-88427 (the SocketType documentation being called misleading) and the open deprecation proposal in #126272. This change is limited to the directive role: it switches .. data:: to .. class:: so existing :class: cross-references resolve, and leaves the deprecation question untouched. While SocketType remains public it should carry the correct role; if it is deprecated later, this can be revisited.

read-the-docs-community Bot commented May 31, 2026 •
edited
Loading

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33011804 | 📁 Comparing 9039fd2 against main (2f8f569)

  🔍 Preview build  

83 files changed · + 1 added · ± 82 modified

+ Added

± Modified

gaborbernat force-pushed the gh-89554-socket-class-roles branch from 79787b0 to 0ad690a Compare May 31, 2026 17:34

Copy link
Copy Markdown
Contributor Author

Amended: this now also corrects the misleading description (SocketType is the base class of socket.socket, not type(socket(...))), addressing gh-88427. That overlaps with #93288, which fixes the wording alone; this combines it with the role change.

Copy link
Copy Markdown
Contributor Author

Backward-compatibility check. No independent :data: references were found, and SocketType is already proposed for deprecation (gh-88427). Minimal breakage.

Comment thread Doc/library/socket.rst Outdated
gaborbernat force-pushed the gh-89554-socket-class-roles branch from 0ad690a to d89fe9f Compare June 1, 2026 15:05
Comment thread Doc/library/socket.rst Outdated
gaborbernat marked this pull request as draft June 1, 2026 16:26
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::", correct the misleading description
(SocketType is the base class of the socket type, not "type(socket(...))"
which is socket.socket; addresses pythongh-88427), move it into the Socket
Objects section, and document the socket object methods and attributes
nested under the socket class, dropping the redundant "socket." prefix.
gaborbernat force-pushed the gh-89554-socket-class-roles branch from d89fe9f to f1bb611 Compare June 1, 2026 16:35
gaborbernat marked this pull request as ready for review June 1, 2026 16:46
gaborbernat requested a review from vstinner June 2, 2026 04:39

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ah thank you! The rendered documentation is much better like that!

There is now a bunch of warnings on the documentation, such as: "c:func reference target not found: connect [ref.func]". I suggested fixes.

Comment thread Doc/library/socket.rst Outdated
Comment thread Doc/library/socket.rst Outdated
Comment thread Doc/library/socket.rst Outdated
Comment thread Doc/library/socket.rst Outdated
Comment thread Doc/library/socket.rst Outdated
Comment thread Doc/library/socket.rst Outdated
Suppress C-domain cross-references that have no target by using the
non-link form (``:c:func:`!connect```, ``!setsockopt``, ``!SCM_RIGHTS``)
and mark the absent ``read``/``write`` methods as non-links, as suggested
in review. The underlying ``close`` call refers to the C library
function, so use ``:c:func:`!close``` rather than a Python method role.
gaborbernat requested a review from vstinner June 3, 2026 13:50
Comment thread Doc/library/socket.rst Outdated
Comment thread Doc/library/socket.rst Outdated
Drop the Socket Objects restructure and the second `.. class:: socket` that
required `:noindex:`. Keep only the change of `SocketType` from `.. data::` to
`.. class::`, in its original place after the `socket` class, with a corrected
description: SocketType is the base class of socket re-exported from _socket,
not `type(socket(...))`.
gaborbernat requested a review from vstinner June 4, 2026 13:38
Per review, document SocketType after the socket class rather than before it.
gaborbernat requested a review from vstinner June 5, 2026 17:44

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM.

vstinner merged commit a621e8a into python:main Jun 10, 2026
34 checks passed
github-project-automation Bot moved this from Todo to Done in Docs PRs Jun 10, 2026
vstinner added the needs backport to 3.15 bugs and security fixes label Jun 10, 2026

Copy link
Copy Markdown

Thanks @gaborbernat for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

bedevere-app Bot commented Jun 10, 2026

Copy link
Copy Markdown

GH-151244 is a backport of this pull request to the 3.15 branch.

bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Jun 10, 2026
vstinner added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels Jun 10, 2026

Copy link
Copy Markdown

Thanks @gaborbernat for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

Copy link
Copy Markdown

Thanks @gaborbernat for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

Copy link
Copy Markdown

Sorry, @gaborbernat and @vstinner, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker a621e8ad811e7d51d69b0969a2bd07888a02db1e 3.13

Copy link
Copy Markdown

Sorry, @gaborbernat and @vstinner, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker a621e8ad811e7d51d69b0969a2bd07888a02db1e 3.14

bedevere-app Bot commented Jun 10, 2026

Copy link
Copy Markdown

GH-151245 is a backport of this pull request to the 3.14 branch.

bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 10, 2026
vstinner removed the needs backport to 3.13 only security fixes label Jun 10, 2026

Copy link
Copy Markdown
Member

Merged. Thanks for your contribution.

vstinner pushed a commit that referenced this pull request Jun 10, 2026
…151244)

gh-89554: Document socket.SocketType as a class (GH-150683)

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::", correct the misleading description
(SocketType is the base class of the socket type, not "type(socket(...))"
which is socket.socket; addresses gh-88427), move it into the Socket
Objects section, and document the socket object methods and attributes
nested under the socket class, dropping the redundant "socket." prefix.
(cherry picked from commit a621e8a)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
vstinner added a commit that referenced this pull request Jun 10, 2026
…1245)

gh-89554: Document socket.SocketType as a class (#150683)

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::", correct the misleading description
(SocketType is the base class of the socket type, not "type(socket(...))"
which is socket.socket; addresses gh-88427), move it into the Socket
Objects section, and document the socket object methods and attributes
nested under the socket class, dropping the redundant "socket." prefix.

(cherry picked from commit a621e8a)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
vstinner added a commit that referenced this pull request Jun 10, 2026
#151245) (#151254)

[3.14] gh-89554: Document socket.SocketType as a class (#150683) (#151245)

gh-89554: Document socket.SocketType as a class (#150683)

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::", correct the misleading description
(SocketType is the base class of the socket type, not "type(socket(...))"
which is socket.socket; addresses gh-88427), move it into the Socket
Objects section, and document the socket object methods and attributes
nested under the socket class, dropping the redundant "socket." prefix.

Backport to 3.13: Replace ":platform: Windows" with
".. availability:: Windows" in ioctl() method.

(cherry picked from commit a621e8a)


(cherry picked from commit 4ef6a37)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
philthompson10 pushed a commit to philthompson10/cpython that referenced this pull request Jun 17, 2026
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::", correct the misleading description
(SocketType is the base class of the socket type, not "type(socket(...))"
which is socket.socket; addresses pythongh-88427), move it into the Socket
Objects section, and document the socket object methods and attributes
nested under the socket class, dropping the redundant "socket." prefix.
gaborbernat deleted the gh-89554-socket-class-roles branch October 3, 2026 15:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL