python / python/cpython

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

未关闭
#100,898 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

docs topic-socket
主要语言
Python
星标
77.2k
派生
36k
平均合并
1 天 9 小时
30 天内合并 PR
558

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 socket 模块文档开始,具体查看常量部分和 getaddrinfo() 条目。将 AF_UNSPEC 与 AF_INET、AF_INET6 和 AF_UNIX 一并提及,并说明它可以作为 family 参数传入,以替代 0。完成标准是,所要求的两个引用都解释了与类型相关的区别。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
documentation, networking
Issue 类型
文档
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。