bpo-33499: Fix pymain_init_pycache_prefix() (GH-8596) · python/cpython@fc96437
@@ -1768,16 +1768,6 @@ pymain_init_tracemalloc(_PyCoreConfig *config)
17681768static _PyInitError
17691769pymain_init_pycache_prefix(_PyCoreConfig *config)
17701770{
1771-wchar_t *env;
1772-1773-int res = config_get_env_var_dup(config, &env,
1774-L"PYTHONPYCACHEPREFIX", "PYTHONPYCACHEPREFIX");
1775-if (res < 0) {
1776-return DECODE_LOCALE_ERR("PYTHONPYCACHEPREFIX", res);
1777- } else if (env) {
1778-config->pycache_prefix = env;
1779- }
1780-17811771const wchar_t *xoption = config_get_xoption(config, L"pycache_prefix");
17821772if (xoption) {
17831773const wchar_t *sep = wcschr(xoption, L'=');
@@ -1790,6 +1780,16 @@ pymain_init_pycache_prefix(_PyCoreConfig *config)
17901780// -X pycache_prefix= can cancel the env var
17911781config->pycache_prefix = NULL;
17921782 }
1783+return _Py_INIT_OK();
1784+ }
1785+1786+wchar_t *env;
1787+int res = config_get_env_var_dup(config, &env,
1788+L"PYTHONPYCACHEPREFIX", "PYTHONPYCACHEPREFIX");
1789+if (res < 0) {
1790+return DECODE_LOCALE_ERR("PYTHONPYCACHEPREFIX", res);
1791+ } else if (env) {
1792+config->pycache_prefix = env;
17931793 }
1794179417951795return _Py_INIT_OK();