provide a way to access the unmodified environment (variables) of a Python script

オープン
#93,446 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python

調査の方向性

実装ファイルやテストは指定されていません。環境の変更と提案された API を理解するため、まず PEP 538 と issue 72367 にあるリンク先の議論を確認してください。具体的な設計とそれに対応するカバレッジについて合意されれば、作業は完了です。

索引モデルが issue の本文から書いたものです。

説明

interpreter-core type-feature

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時間
マージ済み PR(30日)
558

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python/cpython のほかの issue

python/cpython の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。