Skip to content

Commit 358ab69

Browse files
Drop -_Py_GetStdlibDir() and PyConfig.stdlib_dir.
1 parent 25b60de commit 358ab69

File tree

6 files changed

+1
-59
lines changed

6 files changed

+1
-59
lines changed

Include/cpython/initconfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ typedef struct PyConfig {
186186
/* --- Path configuration outputs ----------- */
187187
int module_search_paths_set;
188188
PyWideStringList module_search_paths;
189-
wchar_t *stdlib_dir;
190189
wchar_t *executable;
191190
wchar_t *base_executable;
192191
wchar_t *prefix;

Include/internal/pycore_pathconfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ typedef struct _PyPathConfig {
1313
wchar_t *program_full_path;
1414
wchar_t *prefix;
1515
wchar_t *exec_prefix;
16-
wchar_t *stdlib_dir;
1716
/* Set by Py_SetPath(), or computed by _PyConfig_InitPathConfig() */
1817
wchar_t *module_search_path;
1918
/* Python program name */

Include/internal/pycore_pylifecycle.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ PyAPI_FUNC(PyStatus) _Py_PreInitializeFromConfig(
123123
const PyConfig *config,
124124
const struct _PyArgv *args);
125125

126-
PyAPI_FUNC(const wchar_t *) _Py_GetStdlibDir(const PyConfig *);
127-
128126
PyAPI_FUNC(int) _Py_HandleSystemExit(int *exitcode_p);
129127

130128
PyAPI_FUNC(PyObject*) _PyErr_WriteUnraisableDefaultHook(PyObject *unraisable);

Modules/getpath.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,16 +1540,6 @@ calculate_path(PyCalculatePath *calculate, _PyPathConfig *pathconfig)
15401540
}
15411541
}
15421542

1543-
if (pathconfig->stdlib_dir == NULL) {
1544-
if (calculate->prefix_found) {
1545-
/* This must be done *before* calculate_set_prefix() is called. */
1546-
pathconfig->stdlib_dir = _PyMem_RawWcsdup(calculate->prefix);
1547-
if (pathconfig->stdlib_dir == NULL) {
1548-
return _PyStatus_NO_MEMORY();
1549-
}
1550-
}
1551-
}
1552-
15531543
if (pathconfig->prefix == NULL) {
15541544
status = calculate_set_prefix(calculate, pathconfig);
15551545
if (_PyStatus_EXCEPTION(status)) {

Python/initconfig.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,6 @@ PyConfig_Clear(PyConfig *config)
674674
_PyWideStringList_Clear(&config->xoptions);
675675
_PyWideStringList_Clear(&config->module_search_paths);
676676
config->module_search_paths_set = 0;
677-
CLEAR(config->stdlib_dir);
678677

679678
CLEAR(config->executable);
680679
CLEAR(config->base_executable);
@@ -915,7 +914,6 @@ _PyConfig_Copy(PyConfig *config, const PyConfig *config2)
915914
COPY_WSTRLIST(xoptions);
916915
COPY_WSTRLIST(module_search_paths);
917916
COPY_ATTR(module_search_paths_set);
918-
COPY_WSTR_ATTR(stdlib_dir);
919917

920918
COPY_WSTR_ATTR(executable);
921919
COPY_WSTR_ATTR(base_executable);
@@ -1026,7 +1024,6 @@ _PyConfig_AsDict(const PyConfig *config)
10261024
SET_ITEM_WSTR(home);
10271025
SET_ITEM_INT(module_search_paths_set);
10281026
SET_ITEM_WSTRLIST(module_search_paths);
1029-
SET_ITEM_WSTR(stdlib_dir);
10301027
SET_ITEM_WSTR(executable);
10311028
SET_ITEM_WSTR(base_executable);
10321029
SET_ITEM_WSTR(prefix);
@@ -1354,7 +1351,6 @@ _PyConfig_FromDict(PyConfig *config, PyObject *dict)
13541351
// Path configuration output
13551352
GET_UINT(module_search_paths_set);
13561353
GET_WSTRLIST(module_search_paths);
1357-
GET_WSTR_OPT(stdlib_dir);
13581354
GET_WSTR_OPT(executable);
13591355
GET_WSTR_OPT(base_executable);
13601356
GET_WSTR_OPT(prefix);
@@ -3131,7 +3127,6 @@ _Py_DumpPathConfig(PyThreadState *tstate)
31313127
PySys_WriteStderr(" environment = %i\n", config->use_environment);
31323128
PySys_WriteStderr(" user site = %i\n", config->user_site_directory);
31333129
PySys_WriteStderr(" import site = %i\n", config->site_import);
3134-
DUMP_CONFIG("stdlib dir", stdlib_dir);
31353130
#undef DUMP_CONFIG
31363131

31373132
#define DUMP_SYS(NAME) \

Python/pathconfig.c

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ pathconfig_clear(_PyPathConfig *config)
5555
CLEAR(config->program_full_path);
5656
CLEAR(config->prefix);
5757
CLEAR(config->exec_prefix);
58-
CLEAR(config->stdlib_dir);
5958
CLEAR(config->module_search_path);
6059
CLEAR(config->program_name);
6160
CLEAR(config->home);
@@ -85,7 +84,6 @@ pathconfig_copy(_PyPathConfig *config, const _PyPathConfig *config2)
8584
COPY_ATTR(prefix);
8685
COPY_ATTR(exec_prefix);
8786
COPY_ATTR(module_search_path);
88-
COPY_ATTR(stdlib_dir);
8987
COPY_ATTR(program_name);
9088
COPY_ATTR(home);
9189
#ifdef MS_WINDOWS
@@ -170,7 +168,6 @@ pathconfig_set_from_config(_PyPathConfig *pathconfig, const PyConfig *config)
170168
COPY_CONFIG(program_full_path, executable);
171169
COPY_CONFIG(prefix, prefix);
172170
COPY_CONFIG(exec_prefix, exec_prefix);
173-
COPY_CONFIG(stdlib_dir, stdlib_dir);
174171
COPY_CONFIG(program_name, program_name);
175172
COPY_CONFIG(home, home);
176173
#ifdef MS_WINDOWS
@@ -222,7 +219,6 @@ _PyPathConfig_AsDict(void)
222219
SET_ITEM_STR(prefix);
223220
SET_ITEM_STR(exec_prefix);
224221
SET_ITEM_STR(module_search_path);
225-
SET_ITEM_STR(stdlib_dir);
226222
SET_ITEM_STR(program_name);
227223
SET_ITEM_STR(home);
228224
#ifdef MS_WINDOWS
@@ -316,7 +312,6 @@ config_init_module_search_paths(PyConfig *config, _PyPathConfig *pathconfig)
316312
317313
- exec_prefix
318314
- module_search_path
319-
- stdlib_dir
320315
- prefix
321316
- program_full_path
322317
@@ -407,7 +402,6 @@ config_init_pathconfig(PyConfig *config, int compute_path_config)
407402
COPY_ATTR(program_full_path, executable);
408403
COPY_ATTR(prefix, prefix);
409404
COPY_ATTR(exec_prefix, exec_prefix);
410-
COPY_ATTR(stdlib_dir, stdlib_dir);
411405

412406
#undef COPY_ATTR
413407

@@ -493,25 +487,16 @@ Py_SetPath(const wchar_t *path)
493487

494488
PyMem_RawFree(_Py_path_config.prefix);
495489
PyMem_RawFree(_Py_path_config.exec_prefix);
496-
PyMem_RawFree(_Py_path_config.stdlib_dir);
497490
PyMem_RawFree(_Py_path_config.module_search_path);
498491

499492
_Py_path_config.prefix = _PyMem_RawWcsdup(L"");
500493
_Py_path_config.exec_prefix = _PyMem_RawWcsdup(L"");
501-
// XXX Copy this from the new module_search_path?
502-
if (_Py_path_config.home != NULL) {
503-
_Py_path_config.stdlib_dir = _PyMem_RawWcsdup(_Py_path_config.home);
504-
}
505-
else {
506-
_Py_path_config.stdlib_dir = _PyMem_RawWcsdup(L"");
507-
}
508494
_Py_path_config.module_search_path = _PyMem_RawWcsdup(path);
509495

510496
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
511497

512498
if (_Py_path_config.prefix == NULL
513499
|| _Py_path_config.exec_prefix == NULL
514-
|| _Py_path_config.stdlib_dir == NULL
515500
|| _Py_path_config.module_search_path == NULL)
516501
{
517502
path_out_of_memory(__func__);
@@ -531,13 +516,10 @@ Py_SetPythonHome(const wchar_t *home)
531516

532517
PyMem_RawFree(_Py_path_config.home);
533518
_Py_path_config.home = _PyMem_RawWcsdup(home);
534-
if (_Py_path_config.home != NULL) {
535-
_Py_path_config.stdlib_dir = _PyMem_RawWcsdup(home);
536-
}
537519

538520
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
539521

540-
if (_Py_path_config.home == NULL || _Py_path_config.stdlib_dir == NULL) {
522+
if (_Py_path_config.home == NULL) {
541523
path_out_of_memory(__func__);
542524
}
543525
}
@@ -591,27 +573,6 @@ Py_GetPath(void)
591573
}
592574

593575

594-
const wchar_t *
595-
_Py_GetStdlibDir(const PyConfig *fallback)
596-
{
597-
wchar_t *stdlib_dir = _Py_path_config.stdlib_dir;
598-
if (stdlib_dir != NULL && stdlib_dir[0] != L'\0') {
599-
return stdlib_dir;
600-
}
601-
if (fallback == NULL) {
602-
fallback = _Py_GetMainConfig();
603-
if (fallback == NULL) {
604-
return NULL;
605-
}
606-
}
607-
stdlib_dir = fallback->stdlib_dir;
608-
if (stdlib_dir != NULL && stdlib_dir[0] != L'\0') {
609-
return stdlib_dir;
610-
}
611-
return NULL;
612-
}
613-
614-
615576
wchar_t *
616577
Py_GetPrefix(void)
617578
{

0 commit comments

Comments
 (0)