python / python/cpython

Documentation for os.environ should say that os.environ caching behavior is undefined if other threads are setting environment values

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

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

docs topic-free-threading
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Documentation

It says here:

This mapping is captured the first time the os module is imported, typically during Python startup as part of processing site.py. Changes to the environment made after this time are not reflected in os.environ, except for changes made by modifying os.environ directly.

It should mention the caveat that such cashing would cause undefined behavior or/and crashes when other threads would be setting environment values. This would be true at least on Linux and FreeBSD.

The same should be mentioned in the documentation of the function that initializes the Python interpreter and caches environment.

These functions are not thread-safe.

Linked PRs
  • gh-152979

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

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

はじめの一歩

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

調査の方向性

issue にリンクされている os.environ のドキュメントと、環境をキャッシュするインタープリター初期化関数のドキュメントを確認します。要求されているスレッドセーフティに関する注意書きを、リンクされている PR gh-152979 と比較します。他のスレッドが環境の値を変更した場合の動作を、関連する両方のドキュメント領域が正確に説明していれば完了です。

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

評価

技術スタック
python
領域
documentation, operating-systems
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

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

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