MCPcopy Index your code
hub / github.com/RustPython/RustPython / inode

Method inode

crates/vm/src/stdlib/os.rs:814–835  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

812 #[cfg(windows)]
813 #[pymethod]
814 fn inode(&self, vm: &VirtualMachine) -> PyResult<u128> {
815 match self.ino.load() {
816 Some(ino) => Ok(ino),
817 None => {
818 let stat = stat_inner(
819 OsPath::new_str(self.pathval.as_os_str()).into(),
820 DirFd::default(),
821 FollowSymlinks(false),
822 )
823 .map_err(|e| e.into_pyexception(vm))?
824 .ok_or_else(|| crate::exceptions::cstring_error(vm))?;
825 // On Windows, combine st_ino and st_ino_high into 128-bit value
826 #[cfg(windows)]
827 let ino: u128 = stat.st_ino as u128 | ((stat.st_ino_high as u128) << 64);
828 #[cfg(not(windows))]
829 let ino: u128 = stat.st_ino as u128;
830 // Err(T) means other thread set `ino` at the mean time which is safe to ignore
831 let _ = self.ino.compare_exchange(None, Some(ino));
832 Ok(ino)
833 }
834 }
835 }
836
837 #[cfg(unix)]
838 #[pymethod]

Callers 4

check_entryMethod · 0.80
test_removed_dirMethod · 0.80
test_removed_fileMethod · 0.80
test_broken_symlinkMethod · 0.80

Calls 8

stat_innerFunction · 0.85
FollowSymlinksClass · 0.85
cstring_errorFunction · 0.85
ok_or_elseMethod · 0.80
as_os_strMethod · 0.80
SomeClass · 0.50
loadMethod · 0.45
into_pyexceptionMethod · 0.45

Tested by 4

check_entryMethod · 0.64
test_removed_dirMethod · 0.64
test_removed_fileMethod · 0.64
test_broken_symlinkMethod · 0.64