Bug report
Bug description:
The solution to issue GH-126789 (found in GH-127729 / 7015485) 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
Bug report
Bug description:
The solution to issue GH-126789 (found in GH-127729 / 7015485) 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()andsysconfig.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/pythonAnd then executing:
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