mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-45211: Remember the stdlib dir during startup. (gh-28586)
During runtime startup we figure out the stdlib dir but currently throw that information away. This change preserves it and exposes it via PyConfig.stdlib_dir, _Py_GetStdlibDir(), and sys._stdlib_dir. https://bugs.python.org/issue45211
This commit is contained in:
parent
84975146a7
commit
0c50b8c0b8
10 changed files with 93 additions and 3 deletions
|
@ -1492,6 +1492,16 @@ calculate_path(PyCalculatePath *calculate, _PyPathConfig *pathconfig)
|
|||
}
|
||||
}
|
||||
|
||||
if (pathconfig->stdlib_dir == NULL) {
|
||||
if (calculate->prefix_found) {
|
||||
/* This must be done *before* calculate_set_prefix() is called. */
|
||||
pathconfig->stdlib_dir = _PyMem_RawWcsdup(calculate->prefix);
|
||||
if (pathconfig->stdlib_dir == NULL) {
|
||||
return _PyStatus_NO_MEMORY();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pathconfig->prefix == NULL) {
|
||||
status = calculate_set_prefix(calculate, pathconfig);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue