From 98e3d269063afa1fc368b4df43a93b6fc8156de2 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Sat, 6 Nov 2021 16:57:38 +0900 Subject: [PATCH] Use PyPathLike::into_cstring --- vm/src/stdlib/posix.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vm/src/stdlib/posix.rs b/vm/src/stdlib/posix.rs index 6e3ca96c7..3d841cba4 100644 --- a/vm/src/stdlib/posix.rs +++ b/vm/src/stdlib/posix.rs @@ -1278,7 +1278,10 @@ pub mod module { fn spawn(self, spawnp: bool, vm: &VirtualMachine) -> PyResult { use crate::TryFromBorrowedObject; - let path = CString::new(self.path.clone().into_bytes()) + let path = self + .path + .clone() + .into_cstring(vm) .map_err(|_| vm.new_value_error("path should not have nul bytes".to_owned()))?; let mut file_actions = unsafe {