python / python/cpython

Need for a few corrections/updates regarding the `inspect.ismethoddescriptor()`'s and `inspect.isdatadescriptor()`'s docs and unit tests

未關閉
#122,102 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

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

描述

Documentation

  1. The main correction that needs to be made regards this fragment of the docs of inspect.ismethoddescriptor():

    Return True if the object is a method descriptor, but not if ismethod(), isclass(), isfunction() or isbuiltin() are true.

    The problem is that, in fact, the inspect.ismethoddescriptor() function does not engage the inspect.isbuiltin() function at all (whereas it does engage the rest of the said functions).

    (As it seems, the mistaken statement was introduced long ago...)

  2. Another thing worth fixing is the lack of the information that the inspect.isdatadescriptor() function also returns False if any of the ismethod(), isclass() or isfunction() tests are true.

  3. There are also a few other fragments of the docs of those two functions (inspect.ismethoddescriptor() and inspect.isdatadescriptor()) which seem to me worth updating/rewording...

  4. Naturally, it also seems a good idea to update the docstrings of those two functions (where applicable).

All those improvements have been proposed by submitting the first PR attached to this issue [update: merged].

Tests

By the way, it seems worth to make the unit tests for those two functions be more comprehensive as well as consistent with each other.

The tests-related improvements have been proposed by submitting the second PR attached to this issue.

Linked PRs
  • gh-122104
  • gh-122144
  • gh-153948
  • gh-153949
  • gh-153950

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

先查看 inspect.ismethoddescriptor() 和 inspect.isdatadescriptor() 的文件及 docstring,然後檢視這兩個函式現有的單元測試。連結的 PR 描述了提議的文件和測試更新,或包含這些更新;當這些修正以及更一致的涵蓋率合併後,這項工作就完成了。

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

評估

技術堆疊
python
領域
documentation, testing
Issue 類型
文件
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
描述清楚
新手友好度
20/100

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

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