From 5701061e63f5652e76611cc5d797ac8c0bee0d88 Mon Sep 17 00:00:00 2001 From: Padraic Fanning Date: Fri, 16 Dec 2022 21:56:09 -0500 Subject: [PATCH 1/3] Fix new (v1.66) Clippy warnings --- derive/src/util.rs | 2 +- vm/src/stdlib/os.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/derive/src/util.rs b/derive/src/util.rs index a0d848b69..fff2a403b 100644 --- a/derive/src/util.rs +++ b/derive/src/util.rs @@ -67,7 +67,7 @@ impl ItemNursery { if !inserted { return Err(syn::Error::new( item.attr_name.span(), - &format!("Duplicated #[py*] attribute found for {:?}", &item.py_names), + format!("Duplicated #[py*] attribute found for {:?}", &item.py_names), )); } } diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index 6862ad0af..c439c6e6a 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -1521,7 +1521,7 @@ pub(super) mod _os { }; let tick_for_second = unsafe { libc::sysconf(libc::_SC_CLK_TCK) } as f64; - let c = unsafe { libc::times(&mut t as *mut _) } as i64; + let c = unsafe { libc::times(&mut t as *mut _) }; if c == -1 { return Err(vm.new_os_error("Fail to get times".to_string())); From 268bbd8414059c16886c600c08d803a2ba76341f Mon Sep 17 00:00:00 2001 From: Padraic Fanning Date: Fri, 16 Dec 2022 22:38:58 -0500 Subject: [PATCH 2/3] Fix new (v1.66) Clippy warnings on Windows --- vm/src/stdlib/os.rs | 2 +- vm/src/stdlib/winreg.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index c439c6e6a..511effcec 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -1109,7 +1109,7 @@ pub(super) mod _os { // TODO: replicate CPython's win32_xstat let [] = dir_fd.0; let meta = match file { - PathOrFd::Path(path) => super::fs_metadata(&path, follow_symlinks.0)?, + PathOrFd::Path(path) => super::fs_metadata(path, follow_symlinks.0)?, PathOrFd::Fd(fno) => { use std::os::windows::io::FromRawHandle; let handle = Fd(fno).to_raw_handle()?; diff --git a/vm/src/stdlib/winreg.rs b/vm/src/stdlib/winreg.rs index 17a430fd6..660df63da 100644 --- a/vm/src/stdlib/winreg.rs +++ b/vm/src/stdlib/winreg.rs @@ -258,7 +258,7 @@ mod winreg { value: PyStrRef, vm: &VirtualMachine, ) -> PyResult<()> { - if typ != REG_SZ as u32 { + if typ != REG_SZ { return Err(vm.new_type_error("type must be winreg.REG_SZ".to_owned())); } let subkey = subkey.as_ref().map_or("", |s| s.as_str()); From 1b5133350b760c8530d366cc1877d17e35f093f0 Mon Sep 17 00:00:00 2001 From: Padraic Fanning Date: Fri, 16 Dec 2022 22:37:26 -0500 Subject: [PATCH 3/3] Fix macOS compilation error (v1.66) --- vm/src/stdlib/os.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index 511effcec..210cc3f82 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -1523,7 +1523,8 @@ pub(super) mod _os { let tick_for_second = unsafe { libc::sysconf(libc::_SC_CLK_TCK) } as f64; let c = unsafe { libc::times(&mut t as *mut _) }; - if c == -1 { + // XXX: The signedness of `clock_t` varies from platform to platform. + if c == (-1i8) as libc::clock_t { return Err(vm.new_os_error("Fail to get times".to_string())); }