Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-91985: Introduce _is_python_build member to struct _PyPathConfig for getpath #92411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Modules/getpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ def search_up(prefix, *landmarks, test=isfile):

build_prefix = None

if not home_was_set and real_executable_dir and not py_setpath:
if (not home_was_set and real_executable_dir and not py_setpath) or \
config.get('_is_python_build'):
# Detect a build marker and use it to infer prefix, exec_prefix,
# stdlib_dir and the platstdlib_dir directories.
try:
Expand Down
4 changes: 4 additions & 0 deletions Python/pathconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ typedef struct _PyPathConfig {
wchar_t *program_name;
/* Set by Py_SetPythonHome() or PYTHONHOME environment variable */
wchar_t *home;
int _is_python_build;
} _PyPathConfig;

# define _PyPathConfig_INIT \
Expand Down Expand Up @@ -72,6 +73,7 @@ _PyPathConfig_ClearGlobal(void)
CLEAR(calculated_module_search_path);
CLEAR(program_name);
CLEAR(home);
_Py_path_config._is_python_build = 0;

#undef CLEAR

Expand Down Expand Up @@ -105,6 +107,7 @@ _PyPathConfig_ReadGlobal(PyConfig *config)
COPY(program_name);
COPY(home);
COPY2(executable, program_full_path);
config->_is_python_build = _Py_path_config._is_python_build;
// module_search_path must be initialised - not read
#undef COPY
#undef COPY2
Expand Down Expand Up @@ -143,6 +146,7 @@ _PyPathConfig_UpdateGlobal(const PyConfig *config)
COPY(program_name);
COPY(home);
COPY2(program_full_path, executable);
_Py_path_config._is_python_build = config->_is_python_build;
#undef COPY
#undef COPY2

Expand Down