Bug report
TestSysConfig.tearDown() restores sysconfig._CONFIG_VARS, but not sysconfig._config_vars_cached_prefix and sysconfig._config_vars_cached_exec_prefix.
test_sysconfig_config_vars_no_prefix_cache sets sys.prefix to 'prefix-BBB' and calls get_config_vars(), so the cached prefix keeps that value after the test. The next get_config_vars() call finds the cache stale and replaces _CONFIG_VARS with a new dict:
cached prefix before: /usr/local
cached prefix after : prefix-BBB
rebuilt: True
regrtest reports this as Warning -- sysconfig._CONFIG_VARS was modified by test_sysconfig, because its own check calls sysconfig.get_config_var('prefix') before comparing:
$ ./python -m test --fail-env-changed test_sysconfig -m test_sysconfig_config_vars_no_prefix_cache
Result: ENV CHANGED
Linked PRs
Bug report
TestSysConfig.tearDown()restoressysconfig._CONFIG_VARS, but notsysconfig._config_vars_cached_prefixandsysconfig._config_vars_cached_exec_prefix.test_sysconfig_config_vars_no_prefix_cachesetssys.prefixto'prefix-BBB'and callsget_config_vars(), so the cached prefix keeps that value after the test. The nextget_config_vars()call finds the cache stale and replaces_CONFIG_VARSwith a new dict:regrtest reports this as
Warning -- sysconfig._CONFIG_VARS was modified by test_sysconfig, because its own check callssysconfig.get_config_var('prefix')before comparing:Linked PRs