GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-89554: Document socket.SocketType as a class by gaborbernat · Pull Request #150683 · python/cpython

Conversation

@gaborbernat

@gaborbernat gaborbernat commented May 31, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels May 31, 2026
@github-project-automation github-project-automation Bot added this to Docs PRs May 31, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs May 31, 2026
@bedevere-app bedevere-app Bot mentioned this pull request May 31, 2026
Intersphinx inventory classifies some type-like objects as data #89554
Open
@bedevere-app bedevere-app Bot added the awaiting review label May 31, 2026
@gaborbernat gaborbernat mentioned this pull request May 31, 2026
gh-89554: Document socket, thread and expat type objects as classes #150681
Closed
@gaborbernat

gaborbernat commented May 31, 2026

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@read-the-docs-community

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

Uh oh!

There was an error while loading. Please reload this page.

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

  • howto/abi3t-migration.html

± Modified

  • bugs.html
  • glossary.html
  • c-api/complex.html
  • c-api/exceptions.html
  • c-api/interp-lifecycle.html
  • c-api/perfmaps.html
  • c-api/stable.html
  • c-api/structures.html
  • c-api/typehints.html
  • c-api/unicode.html
  • and 72 more...
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

gaborbernat commented May 31, 2026

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gaborbernat

gaborbernat commented Jun 1, 2026

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner
vstinner reviewed Jun 1, 2026
View reviewed changes
Comment thread Doc/library/socket.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gaborbernat
gaborbernat force-pushed the gh-89554-socket-class-roles branch from 0ad690a to d89fe9f Compare June 1, 2026 15:05
vstinner
vstinner reviewed Jun 1, 2026
View reviewed changes
Comment thread Doc/library/socket.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gaborbernat
gaborbernat marked this pull request as draft June 1, 2026 16:26
@bedevere-app bedevere-app Bot removed the awaiting review label Jun 1, 2026
@gaborbernat
pythongh-89554: Document socket.SocketType as a class
f1bb611
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
gaborbernat force-pushed the gh-89554-socket-class-roles branch from d89fe9f to f1bb611 Compare June 1, 2026 16:35
@gaborbernat
gaborbernat marked this pull request as ready for review June 1, 2026 16:46
@bedevere-app bedevere-app Bot added the awaiting review label Jun 1, 2026
@gaborbernat
gaborbernat requested a review from vstinner June 2, 2026 04:39
vstinner
vstinner reviewed Jun 2, 2026
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/socket.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/socket.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/socket.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/socket.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/socket.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/socket.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gaborbernat
pythongh-89554: Apply review suggestions for socket roles
d6e298f
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
gaborbernat requested a review from vstinner June 3, 2026 13:50
vstinner
vstinner reviewed Jun 4, 2026
View reviewed changes
Comment thread Doc/library/socket.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/socket.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gaborbernat
Document SocketType as a class without restructuring the socket methods
c08bf8c
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
gaborbernat requested a review from vstinner June 4, 2026 13:38
gaborbernat added 2 commits June 4, 2026 06:43
@gaborbernat
Revert "Document SocketType as a class without restructuring the sock…
a6103c4
…et methods"

This reverts commit c08bf8c.
@gaborbernat
Move SocketType after the socket class
9e719a9
Per review, document SocketType after the socket class rather than before it.
@gaborbernat
gaborbernat requested a review from vstinner June 5, 2026 17:44
vstinner
vstinner approved these changes Jun 8, 2026
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jun 8, 2026
@vstinner
vstinner merged commit a621e8a into python:main Jun 10, 2026
34 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Jun 10, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Jun 10, 2026
@vstinner vstinner added the needs backport to 3.15 bugs and security fixes label Jun 10, 2026
@miss-islington-app

miss-islington-app Bot commented 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.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

miss-islington-app Bot commented 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.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app

miss-islington-app Bot commented 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.14.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app

miss-islington-app Bot commented Jun 10, 2026

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app miss-islington-app Bot assigned vstinner Jun 10, 2026
@miss-islington-app

miss-islington-app Bot commented Jun 10, 2026

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

vstinner commented Jun 10, 2026

Copy link
Copy Markdown
Member

Merged. Thanks for your contribution.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner pushed a commit that referenced this pull request Jun 10, 2026
@miss-islington @gaborbernat
[3.15] gh-89554: Document socket.SocketType as a class (GH-150683) (#…
de5da36
…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 <[email protected]>
vstinner added a commit that referenced this pull request Jun 10, 2026
@vstinner @gaborbernat
[3.14] gh-89554: Document socket.SocketType as a class (#150683) (#15…
4ef6a37
…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 <[email protected]>
@vstinner vstinner mentioned this pull request Jun 10, 2026
[3.13][3.14] gh-89554: Document socket.SocketType as a class (#150683) (#151245) #151254
Merged
vstinner added a commit that referenced this pull request Jun 10, 2026
@vstinner @gaborbernat
[3.13][3.14] gh-89554: Document socket.SocketType as a class (#150683) (
a1f43ef
#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 <[email protected]>
philthompson10 pushed a commit to philthompson10/cpython that referenced this pull request Jun 17, 2026
@gaborbernat @philthompson10
pythongh-89554: Document socket.SocketType as a class (python#150683)
610f4dd
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.
This was referenced Sep 6, 2026
[doc] SocketType changed in Python 3 #71566
Closed
gh-71566: Fix SocketType introduction in the socket documentation. #93288
Closed
@gaborbernat
gaborbernat deleted the gh-89554-socket-class-roles branch October 3, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@vstinner vstinner

Labels

docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@gaborbernat @vstinner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.