--- /dev/null
+Python ignored path passed to :c:func:`Py_SetPath`, fix Python
+initialization to use the specified path.
"Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]\n");
}
- status = calculate_module_search_path(config, calculate,
- prefix, exec_prefix, pathconfig);
- if (_PyStatus_EXCEPTION(status)) {
- return status;
+ if (pathconfig->module_search_path == NULL) {
+ status = calculate_module_search_path(config, calculate,
+ prefix, exec_prefix, pathconfig);
+ if (_PyStatus_EXCEPTION(status)) {
+ return status;
+ }
}
status = calculate_reduce_prefix(calculate, prefix, Py_ARRAY_LENGTH(prefix));
calculate_home_prefix(calculate, prefix);
- status = calculate_module_search_path(config, calculate, pathconfig, prefix);
- if (_PyStatus_EXCEPTION(status)) {
- return status;
+ if (pathconfig->module_search_path == NULL) {
+ status = calculate_module_search_path(config, calculate,
+ pathconfig, prefix);
+ if (_PyStatus_EXCEPTION(status)) {
+ return status;
+ }
}
done:
PyMemAllocatorEx old_alloc;
_PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
+ if (copy_wstr(&new_config.module_search_path,
+ _Py_path_config.module_search_path) < 0)
+ {
+ status = _PyStatus_NO_MEMORY();
+ goto error;
+ }
+
/* Calculate program_full_path, prefix, exec_prefix,
dll_path (Windows), and module_search_path */
status = _PyPathConfig_Calculate(&new_config, config);