python / python/cpython

Docstring of array.array misses 'w' type info and mentions wide/narrow builds

未关闭
#142,083 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

docs
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

Documentation

The docstring of array.array at https://github.com/python/cpython/blob/cfcd52490d6531f3b0e8ddd4bb2b40fb6baee854/Modules/arraymodule.c#L2912 has a few mistakes:

  1. in description of 'u' type it mentions the narrow/wide build split that is not a thing since 3.3 - https://docs.python.org/3/whatsnew/3.3.html#functionality
  2. it doesn't mention that since 3.3 the 'u' type is deprecated and 'w' should be used.
  3. it doesn't mention that 'u' type since 3.9 corresponds to wchar_t of C compiler used (so usually 2 byte UTF-16 on Windows, 4 byte UTF-32 elsewhere), instead of to narrow/wide Python build.
  4. it doesn't mention the newer 'w' type that is Python's own Py_UCS4 4 byte UTF-32.

The documentation at https://docs.python.org/3/library/array.html doesn't have these issues, only the docstring (that is shown in help(array.array) in the REPL) does. This is a mismatch between documentation and docstring.

Linked PRs
  • gh-142323

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

先从 Modules/arraymodule.c 中 issue 所引用的 array.array docstring 附近开始,然后将其与 docs.python.org/3/library/array.html 中的 array 文档进行比较。完成的标准是:docstring 涵盖当前的 'u' 和 'w' 类型信息,并且不再使用关于 narrow/wide build 的过时表述;开始前检查已链接的 PR gh-142323。

由索引模型根据 Issue 内容生成。

评估

技术栈
c, python
领域
documentation
Issue 类型
文档
难度
1/5
预计耗时
1 小时以内
活跃度
停滞
描述清晰度
描述清楚
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。