Skip to content

gh-150162: Fix sysconfig cross-compile impermanence#150164

Open
hetmankp wants to merge 1 commit into
python:mainfrom
hetmankp:gh-150162
Open

gh-150162: Fix sysconfig cross-compile impermanence#150164
hetmankp wants to merge 1 commit into
python:mainfrom
hetmankp:gh-150162

Conversation

@hetmankp
Copy link
Copy Markdown
Contributor

@hetmankp hetmankp commented May 20, 2026

Fixes issue #150162 by improving the code introduced by 7015485 (GH-127729) while retaining the original documented intent. The aforementioned code has a side effect when used in a virtual environment context, on posix platforms, with the cross-compiling environment variable _PYTHON_PROJECT_BASE present. In this case, every single sysconfig.get_config_vars() and sysconfig.get_config_var() call, forces the _CONFIG_VARS dictionary to be reinitialised from scratch. This is inefficient, but also means no changes to the dictionary returned by sysconfig.get_config_vars() persist, which can be useful in certain situations.

This commit tracks changes to sys.prefix and sys.exec_prefix more directly rather than relying on a misalignment with the corresponding sysconfig variables.

Fixes issue python#150162 by improving the code introduced by 7015485
(pythonGH-127729) while retaining the original documented intent. The
aforementioned code has a side effect when used in a virtual environment
context, on posix platforms, with the cross-compiling environment
variable _PYTHON_PROJECT_BASE present. In this case, every single
sysconfig.get_config_vars() and sysconfig.get_config_var() call, forces
the _CONFIG_VARS dictionary to be reinitialised from scratch. This is
inefficient, but also means no changes to the dictionary returned by
sysconfig.get_config_vars() persist, which can be useful in certain
situations.

This commit tracks changes to sys.prefix and sys.exec_prefix more
directly rather than relying on a misalignment with the corresponding
sysconfig variables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant