(whence: i32)
| 151 | |
| 152 | #[allow(clippy::let_and_return)] |
| 153 | fn validate_whence(whence: i32) -> bool { |
| 154 | let x = (0..=2).contains(&whence); |
| 155 | cfg_if::cfg_if! { |
| 156 | if #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "linux"))] { |
| 157 | x || matches!(whence, libc::SEEK_DATA | libc::SEEK_HOLE) |
| 158 | } else { |
| 159 | x |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | fn ensure_unclosed(file: &PyObject, msg: &str, vm: &VirtualMachine) -> PyResult<()> { |
| 165 | if file.get_attr("closed", vm)?.try_to_bool(vm)? { |