mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -2974,6 +2974,14 @@ _PySys_UpdateConfig(PyThreadState *tstate)
|
|||
|
||||
SET_SYS("_xoptions", sys_create_xoptions_dict(config));
|
||||
|
||||
const wchar_t *stdlibdir = _Py_GetStdlibDir();
|
||||
if (stdlibdir != NULL) {
|
||||
SET_SYS_FROM_WSTR("_stdlib_dir", stdlibdir);
|
||||
}
|
||||
else {
|
||||
PyDict_SetItemString(sysdict, "_stdlib_dir", Py_None);
|
||||
}
|
||||
|
||||
#undef SET_SYS_FROM_WSTR
|
||||
#undef COPY_LIST
|
||||
#undef COPY_WSTR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue