Skip to content

SocketType documentation misleading #88427

Open

Description

@srittau
mannequin
BPO 44261
Nosy @srittau, @JelleZijlstra

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-05-28.15:21:42.596>
labels = ['docs']
title = 'SocketType documentation misleading'
updated_at = <Date 2021-05-29.23:00:46.252>
user = 'https://github.com/srittau'

bugs.python.org fields:

activity = <Date 2021-05-29.23:00:46.252>
actor = 'JelleZijlstra'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2021-05-28.15:21:42.596>
creator = 'srittau'
dependencies = []
files = []
hgrepos = []
issue_num = 44261
keywords = []
message_count = 2.0
messages = ['394665', '394743']
nosy_count = 3.0
nosy_names = ['srittau', 'docs@python', 'JelleZijlstra']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue44261'
versions = []

Linked PRs

Activity

  1. srittau commented on May 28, 2021

    srittaumannequin
    MannequinAuthor

    The documentation of socket.SocketType (https://docs.python.org/3/library/socket.html?highlight=sockettype#socket.SocketType) is misleading. It states:

    This is a Python type object that represents the socket object type. It is the same as type(socket(...)).
    

    This is untrue. socket.SocketType is in reality re-exported from _socket, where it is an alias for class _socket.socket, a super type of class socket.socket. I think that either the documentation should be fixed, or SocketType should be moved to socket and made an alias of socket.socket.

  2. JelleZijlstra commented on May 29, 2021

    @JelleZijlstra
    Member

    I propose to deprecate socket.SocketType. There's no reason to publicly expose _socket.socket separately from socket.socket, the only type that moat users should care about.

    SocketType isn't needed for type checking; socket.socket is itself a class and can be used in type annotations.

  3. transferred this issue fromon Apr 10, 2022
  4. added 3 commits that reference this issue on May 31, 2026
  5. added 4 commits that reference this issue on Jun 10, 2026
  6. added a commit that references this issue on Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirextension-modulesC modules in the Modules dirtopic-socketRelated to the socket, socketserver and selectors modulestype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions