| 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] |