Skip to content

Commit 50098de

Browse files
Update src/lib.rs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent a1c5ec6 commit 50098de

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ fn run_file(vm: &VirtualMachine, scope: Scope, path: &str) -> PyResult<()> {
177177
if !vm.state.config.settings.safe_path {
178178
let dir = std::path::Path::new(path)
179179
.parent()
180-
.unwrap()
181-
.to_str()
182-
.unwrap();
180+
.and_then(|p| p.to_str())
181+
.unwrap_or("");
183182
vm.insert_sys_path(vm.new_pyobj(dir))?;
184183
}
185184

0 commit comments

Comments
 (0)