PYTHONDONTWRITEBYTECODE documentation is incorrect
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Documentation
PYTHONDONTWRITEBYTECODE is documented in Doc/using/cmdline.rst as:
If this is set to a non-empty string, Python won't try to write
.pycfiles on the import of source modules.
This is incorrect. The variable is obtained in Python/initconfig.c as:
int dont_write_bytecode = 0;
_Py_get_env_flag(use_env, &dont_write_bytecode, "PYTHONDONTWRITEBYTECODE");
if (dont_write_bytecode) {
config->write_bytecode = 0;
}
and _Py_get_env_flag reads the environment variable value as integer, treating non-integer string as 1. Specifically, this means that PYTHONDONTWRITEBYTECODE=0 will not suppress writing .pyc files, even though the environment variable is assigned a non-empty string "0".
Linked PRs
- gh-143144
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Doc/using/cmdline.rst 开始,将文档中描述的行为与 Python/initconfig.c 进行比较,尤其要关注 issue 中所示的 _Py_get_env_flag 调用。更新环境变量描述,使其整数解析和 PYTHONDONTWRITEBYTECODE=0 的行为准确无误;当措辞与实现一致时,文档就完成了。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 35/100