python / python/cpython

sysconfig variable impermanence in virtual environment when cross-compiling

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

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

stdlib topic-sysconfig type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:

The solution to issue GH-126789 (found in GH-127729 / 70154855cf69) introduced a side effect when sysconfig variables are fetched in a virtual environment with the _PYTHON_PROJECT_BASE environment variable present (on posix platforms). Specifically, every invocation of sysconfig.get_config_vars() and sysconfig.get_config_var() causes the variable cache to be reset and rebuilt from scratch. This can be confirmed by running Python as follows:

virtualenv -p /usr/bin/python3.14 env  # 3.14 or higher

_PYTHON_PROJECT_BASE=/any/path env/bin/python

And then executing:

import sysconfig
sysconfig.get_config_vars()['LIBDIR'] = '/some/new/path'
assert sysconfig.get_config_var('LIBDIR') != '/some/new/path'

Rebuilding the variable cache every time is fairly inefficient and prevents the possibility of tweaking the values (a sometimes necessary evil).

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs
  • gh-150164

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

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

はじめの一歩

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

調査の方向性

提供された仮想環境の再現手順と _PYTHON_PROJECT_BASE 設定を使用して、sysconfig.get_config_vars() と sysconfig.get_config_var() から始めます。呼び出しごとにキャッシュが再構築される理由を追跡し、リグレッションテストのカバレッジを追加して、変更された値が後続の検索でも保持されることを確認します。

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

評価

技術スタック
python
領域
build-system
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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