help() of a method wrongly identifies it as a module-level function
未關閉
還沒有人認領這個 Issue。
3.11
3.12
3.13
stdlib
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Consider the following class:
class K:
def verbify(self):
"""Docstring"""
help() on the unbound method (actually a function) K.verbify wrongly identifies it as a module-level function, displaying this in Python3.10:
Help on function verbify in module __main__:
verbify(self)
Docstring
It should identify the function using __qualname__ rather than __name__':
>>> K.verbify.__qualname__
'K.verbify'
>>> K.verbify.__name__
'verbify'
In contrast, help() on the bound method correctly identifies that verbify is a method belonging to K: help(K().verbify) displays verbify() method of __main__.K instance.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用提供的 K.verbify 範例重現問題,並比較 help(K.verbify) 與 help(K().verbify)。追蹤 help() 使用的實作,並更新未繫結函式的描述以使用 qualname;當它能夠識別 K.verbify,同時保留現有的繫結方法描述時,即完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- developer-experience
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100