python / python/cpython

Document that the built-in open() when called with a file descriptor ignores "mode" argument

未關閉
#95,498 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

docs topic-IO
主要語言
Python
星號
77.2k
分支
36k
PR 合併指標
PR 指標待擷取

描述

At https://docs.python.org/3/library/functions.html#open, in the documentation of the mode argument there is no information that this argument is ignored when the function is called with a file descriptor instead of a path.

See Why does os.fdopen ignore mode? SO question. The question talks about os.fdopen() but according to https://docs.python.org/3/library/os.html#os.fdopen

This is an alias of the open() built-in function and accepts the same arguments.

so I think it should be enough to place the information in the documentation of the mode argument of the built-in open() function. This way it would document the built-in open() function but also the os.fdopen() function by virtue of the latter being an alias of the former.

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從連結的內建 open() 文件開始,檢查 mode 引數的說明。查看連結的 os.fdopen() 項目以確認別名脈絡,然後記錄當 open() 接收檔案描述元時會忽略 mode;open() 和 os.fdopen() 的文件應清楚地傳達此行為。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
documentation
Issue 類型
文件
難度
1/5
預估耗時
1 小時以內
活躍度
停滯
描述清晰度
描述清楚
新手友好度
50/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。