python / python/cpython

socket documentation should mention AF_UNSPEC in the section on constants and getaddrinfo() docs

Open
#100,898 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs topic-socket
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Documentation

In the socket module documentation

There should be a mention of AF_UNSPEC alongside AF_INET, AF_INET6 and AF_UNIX in the constants section.
Also e.g. in the getaddrinfo() entry, it should be mentioned you can pass socket.AF_UNSPEC instead of 0.
The difference matters if automated testing is checking type annotations (at least I had this issue submitting
a pull request for pythonosc).

The default family argument for getaddrinfo is 0.
This has type int, not type socket.AddressFamily, whereas socket.AF_UNSPEC,
has the type socket.AddressFamily, but corresponds to the integer 0.

This makes a difference when type annotations are being checked
and the argument to family is expected to be of type socket.AddressFamily.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the socket module documentation, specifically the constants section and the getaddrinfo() entry. Mention AF_UNSPEC alongside AF_INET, AF_INET6, and AF_UNIX, and document that it can be passed instead of 0 for the family argument. Done means both requested references explain the type-relevant distinction.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, networking
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.