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
PR 合併指標
PR 指標待擷取

描述

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 摘要。