Skip to content

Commit 87d866d

Browse files
committed
Implement os.lstat
1 parent 212522a commit 87d866d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

vm/src/stdlib/os.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,17 @@ fn os_stat(path: PyStringRef, vm: &VirtualMachine) -> PyResult {
605605
unimplemented!();
606606
}
607607

608+
fn os_lstat(path: PyStringRef, dir_fd: DirFd, vm: &VirtualMachine) -> PyResult<StatResult> {
609+
os_stat(
610+
path,
611+
dir_fd,
612+
FollowSymlinks {
613+
follow_symlinks: false,
614+
},
615+
vm,
616+
)
617+
}
618+
608619
#[cfg(unix)]
609620
fn os_symlink(
610621
src: PyStringRef,
@@ -788,6 +799,7 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
788799
"ScandirIter" => scandir_iter,
789800
"DirEntry" => dir_entry,
790801
"stat_result" => stat_result,
802+
"lstat" => ctx.new_rustfunc(os_lstat),
791803
"getcwd" => ctx.new_rustfunc(os_getcwd),
792804
"chdir" => ctx.new_rustfunc(os_chdir),
793805
"fspath" => ctx.new_rustfunc(os_fspath),

0 commit comments

Comments
 (0)