Skip to content

Commit f7d918a

Browse files
committed
add seek constants, resolves RustPython#1348
1 parent c973ed8 commit f7d918a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

vm/src/stdlib/os.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use nix::errno::Errno;
1212
#[cfg(all(unix, not(target_os = "redox")))]
1313
use nix::pty::openpty;
1414
#[cfg(unix)]
15-
use nix::unistd::{self, Gid, Pid, Uid};
15+
use nix::unistd::{self, Gid, Pid, Uid, Whence};
1616
use num_traits::cast::ToPrimitive;
1717

1818
use bitflags::bitflags;
@@ -1215,6 +1215,11 @@ fn extend_module_platform_specific(vm: &VirtualMachine, module: PyObjectRef) ->
12151215
"access" => ctx.new_rustfunc(os_access),
12161216
"chmod" => ctx.new_rustfunc(os_chmod),
12171217
"ttyname" => ctx.new_rustfunc(os_ttyname),
1218+
"SEEK_SET" => ctx.new_int(Whence::SeekSet as i8),
1219+
"SEEK_CUR" => ctx.new_int(Whence::SeekCur as i8),
1220+
"SEEK_END" => ctx.new_int(Whence::SeekEnd as i8),
1221+
"SEEK_DATA" => ctx.new_int(Whence::SeekData as i8),
1222+
"SEEK_HOLE" => ctx.new_int(Whence::SeekHole as i8)
12181223
});
12191224

12201225
#[cfg(not(target_os = "redox"))]

0 commit comments

Comments
 (0)