wchar_t *base_prefix; /* sys.base_prefix */
wchar_t *exec_prefix; /* sys.exec_prefix */
wchar_t *base_exec_prefix; /* sys.base_exec_prefix */
-#ifdef MS_WINDOWS
- wchar_t *dll_path; /* Windows DLL path */
-#endif
/* --- Parameter only used by Py_Main() ---------- */
wchar_t *value,
size_t value_size);
+#ifdef MS_WINDOWS
+extern wchar_t* _Py_GetDLLPath(void);
+#endif
+
#ifdef __cplusplus
}
#endif
'legacy_windows_fs_encoding': 0,
})
DEFAULT_CORE_CONFIG.update({
- 'dll_path': GET_DEFAULT_CONFIG,
'legacy_windows_stdio': 0,
})
'filesystem_errors': sys.getfilesystemencodeerrors(),
'module_search_paths': core_config['module_search_paths'],
}
- if sys.platform == 'win32':
- data['dll_path'] = core_config['dll_path']
data = json.dumps(data)
data = data.encode('utf-8')
#endif /* Py_ENABLE_SHARED */
-static _PyInitError
-get_dll_path(PyCalculatePath *calculate, _PyPathConfig *config)
+wchar_t*
+_Py_GetDLLPath(void)
{
wchar_t dll_path[MAXPATHLEN+1];
memset(dll_path, 0, sizeof(dll_path));
dll_path[0] = 0;
#endif
- config->dll_path = _PyMem_RawWcsdup(dll_path);
- if (config->dll_path == NULL) {
- return _Py_INIT_NO_MEMORY();
- }
- return _Py_INIT_OK();
+ return _PyMem_RawWcsdup(dll_path);
}
{
_PyInitError err;
- err = get_dll_path(calculate, config);
- if (_Py_INIT_FAILED(err)) {
- return err;
+ assert(config->dll_path == NULL);
+
+ config->dll_path = _Py_GetDLLPath();
+ if (config->dll_path == NULL) {
+ return _Py_INIT_NO_MEMORY();
}
err = get_program_full_path(core_config, calculate, config);
CLEAR(config->prefix);
CLEAR(config->base_prefix);
CLEAR(config->exec_prefix);
-#ifdef MS_WINDOWS
- CLEAR(config->dll_path);
-#endif
CLEAR(config->base_exec_prefix);
CLEAR(config->filesystem_encoding);
COPY_WSTR_ATTR(prefix);
COPY_WSTR_ATTR(base_prefix);
COPY_WSTR_ATTR(exec_prefix);
-#ifdef MS_WINDOWS
- COPY_WSTR_ATTR(dll_path);
-#endif
COPY_WSTR_ATTR(base_exec_prefix);
COPY_ATTR(site_import);
SET_ITEM_WSTR(base_prefix);
SET_ITEM_WSTR(exec_prefix);
SET_ITEM_WSTR(base_exec_prefix);
-#ifdef MS_WINDOWS
- SET_ITEM_WSTR(dll_path);
-#endif
SET_ITEM_INT(site_import);
SET_ITEM_INT(bytes_warning);
SET_ITEM_INT(inspect);
assert(config->base_prefix != NULL);
assert(config->exec_prefix != NULL);
assert(config->base_exec_prefix != NULL);
-#ifdef MS_WINDOWS
- assert(config->dll_path != NULL);
-#endif
}
assert(config->filesystem_encoding != NULL);
assert(config->filesystem_errors != NULL);
goto no_memory;
}
#ifdef MS_WINDOWS
- if (copy_wstr(&path_config.dll_path, core_config->dll_path) < 0) {
+ path_config.dll_path = _Py_GetDLLPath();
+ if (path_config.dll_path == NULL) {
goto no_memory;
}
#endif
}
}
-#ifdef MS_WINDOWS
- if (config->dll_path == NULL) {
- if (copy_wstr(&config->dll_path, path_config.dll_path) < 0) {
- goto no_memory;
- }
- }
-#endif
-
if (path_config.isolated != -1) {
config->isolated = path_config.isolated;
}
if (!config->use_module_search_paths
|| (config->executable == NULL)
|| (config->prefix == NULL)
-#ifdef MS_WINDOWS
- || (config->dll_path == NULL)
-#endif
|| (config->exec_prefix == NULL))
{
_PyInitError err = _PyCoreConfig_CalculatePathConfig(config);
new_config.exec_prefix = _PyMem_RawWcsdup(L"");
alloc_error |= (new_config.exec_prefix == NULL);
#ifdef MS_WINDOWS
- new_config.dll_path = _PyMem_RawWcsdup(L"");
+ new_config.dll_path = _Py_GetDLLPath();
alloc_error |= (new_config.dll_path == NULL);
#endif
new_config.module_search_path = _PyMem_RawWcsdup(path);