provide a way to access the unmodified environment (variables) of a Python script
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
调研方向
未指定实现文件或测试。首先查看 PEP 538 以及 issue 72367 中链接的讨论,以了解环境变更和提议的 API;当具体设计及相应的覆盖率达成一致时,工作即告完成。
由索引模型根据 Issue 内容生成。
描述
Feature or enhancement
As described in https://github.com/python/cpython/issues/72367#issuecomment-1140355246 and the following comments, the implementation of PEP 538 makes it impossible to access the original unmodified environment (variables) with which a process have been invoked.
I have no problem with the goal of PEP 538 itself or the locale coercion, but this is a problem for any use-case the wants to act on the original locale.
Using PYTHONCOERCECLOCALE=0 is no solution either, as then this modifies the original locale and one couldn't decide whether it's just there to prevent Python's setting of LC_CTYPE=C or whether it was really intended to be in the environment suo jure.
Neither is it obviously a solution to use build-time options.
A solution could be to add another os.original_environment or something like that, which gives the true original environment, without any changes that Python itself may have made.
If Python would ever only modify (by itself) the environment with respect to LC_CTYPE and locale coercion, it could also be enough to simply give the program a way to find out whether that was done, and what the original value (or unset) of LC_CTYPE was.
Pitch
Example use cases are given in the previous discussion mentioned below.
In short, pretty much anything that is intended to serve as a wrapper could require the true original environment.
Imagine one would want to implement the POSIX env utility in Python.
Previous discussion
See https://github.com/python/cpython/issues/72367#issuecomment-1140355246 .
- 主要语言
- 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
-
fix: inaccuracy ⚠️
难度 2/5 1-3 小时 新手友好度 72/100
uabrc/uabrc.github.io#1255 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
ethereum-optimism/factory#64 ·
-
难度 2/5 1-3 小时 新手友好度 90/100
duckdb/duckdb-python#627 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
-
documentation
难度 1/5 1 小时以内 新手友好度 78/100
Qiskit/qiskit-addon-sqd#376 ·