(
&self,
follow_symlinks: bool,
mode_bits: u32,
vm: &VirtualMachine,
)
| 662 | /// Stat-based mode test fallback. Uses fstatat when dir_fd is available. |
| 663 | #[cfg(unix)] |
| 664 | fn test_mode_via_stat( |
| 665 | &self, |
| 666 | follow_symlinks: bool, |
| 667 | mode_bits: u32, |
| 668 | vm: &VirtualMachine, |
| 669 | ) -> PyResult<bool> { |
| 670 | match self.stat(self.stat_dir_fd(), FollowSymlinks(follow_symlinks), vm) { |
| 671 | Ok(stat_obj) => { |
| 672 | let st_mode: i32 = stat_obj.get_attr("st_mode", vm)?.try_into_value(vm)?; |
| 673 | #[allow(clippy::unnecessary_cast)] |
| 674 | Ok((st_mode as u32 & libc::S_IFMT as u32) == mode_bits) |
| 675 | } |
| 676 | Err(e) => { |
| 677 | if e.fast_isinstance(vm.ctx.exceptions.file_not_found_error) { |
| 678 | Ok(false) |
| 679 | } else { |
| 680 | Err(e) |
| 681 | } |
| 682 | } |
| 683 | } |
| 684 | } |
| 685 | |
| 686 | #[pymethod] |
| 687 | fn is_dir(&self, follow_symlinks: FollowSymlinks, vm: &VirtualMachine) -> PyResult<bool> { |
no test coverage detected