object doesn't have an __enter__/__exit__ yet docs say it does
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 48/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
从 issue 中链接的 Python 数据模型文档里关于 object.enter 和 object.exit 的章节开始,并根据 Python 3.10.3 核对其当前措辞。更新文档,明确这些方法并未在 object 上定义,并说明上下文管理器对象会定义它们以提供该接口;当文档描述的行为与运行时行为一致时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Documentation
Here's the current docs in the Python data model on object.__enter__:
object.__enter__(self)
And object.__exit__:
object.__exit__(self, exc_type, exc_value, traceback)
However, with Python 3.10.3, we see neither of these methods belong to object:
>>> object.__enter__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'object' has no attribute '__enter__'. Did you mean: '__ne__'?
>>> object.__exit__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'object' has no attribute '__exit__'. Did you mean: '__init__'?
I think the docs could be:
- More clear that
__enter__and__exit__are not methods onobject - Mention where they come from (just being defined within your object to match the interface)
Thank you for your consideration!
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 558
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python/cpython 的其他 Issue
-
docs pending
难度 2/5 1-3 小时 新手友好度 78/100
-
stdlib type-feature
难度 2/5 1-3 小时 新手友好度 78/100
-
stdlib type-feature
难度 2/5 1-3 小时 新手友好度 72/100
-
build type-bug
难度 2/5 1-3 小时 新手友好度 76/100
-
stdlib topic-email type-feature
难度 2/5 1-3 小时 新手友好度 70/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
难度 2/5 1-3 小时 新手友好度 88/100
OpenHands/extensions#626 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
CSCfi/sd-search-api#39 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 68/100
StevenBlack/hosts#3255 ·