add .chain(Some(0))

This commit is contained in:
shenjack 2025-02-11 21:44:02 +08:00
parent d94841b1bd
commit e5f67475db
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -439,18 +439,18 @@ pub fn init_py() {
#[cfg(target_os = "windows")]
use std::os::windows::ffi::OsStrExt;
let wide_path = OsStr::new(&virtual_env).encode_wide().collect::<Vec<u16>>();
let wide_path = OsStr::new(&virtual_env).encode_wide().chain(Some(0)).collect::<Vec<u16>>();
// 设置 prefix 和 exec_prefix
pyo3::ffi::PyConfig_SetString(
config_ptr,
&mut config.prefix as *mut _,
wide_path.as_ptr() as *mut _,
wide_path.as_slice().as_ptr(),
);
pyo3::ffi::PyConfig_SetString(
config_ptr,
&mut config.exec_prefix as *mut _,
wide_path.as_ptr() as *mut _,
wide_path.as_slice().as_ptr(),
);
// init py