From 0751dcab4b918cb2b6512f3fececc7581524205b Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:04:09 +0100 Subject: [PATCH 01/10] Ensure no warnings on various targets --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6b9742392bb..785c6261d77 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -211,6 +211,8 @@ jobs: name: Ensure compilation on various targets runs-on: ubuntu-latest timeout-minutes: 30 + env: + RUSTFLAGS: -D warnings steps: - uses: actions/checkout@v6.0.2 - uses: dtolnay/rust-toolchain@stable From e926bd32275c8bddb2d4f49b9579aa03bf1fb31e Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:15:36 +0100 Subject: [PATCH 02/10] Fix error on android --- crates/vm/src/stdlib/posix.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/vm/src/stdlib/posix.rs b/crates/vm/src/stdlib/posix.rs index 961f0c6fe0d..7634919c100 100644 --- a/crates/vm/src/stdlib/posix.rs +++ b/crates/vm/src/stdlib/posix.rs @@ -51,7 +51,6 @@ pub mod module { use nix::{ errno::Errno, fcntl, - sys::signal, unistd::{self, Gid, Pid, Uid}, }; use rustpython_common::os::ffi::OsStringExt; @@ -1530,6 +1529,8 @@ pub mod module { #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))] impl PosixSpawnArgs { fn spawn(self, spawnp: bool, vm: &VirtualMachine) -> PyResult { + use nix::sys::signal; + use crate::TryFromBorrowedObject; let path = self From 9755395c7d342a50b3cdf883766cfb3c2e17314e Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:33:34 +0100 Subject: [PATCH 03/10] More unused imports --- crates/vm/src/stdlib/posix.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/vm/src/stdlib/posix.rs b/crates/vm/src/stdlib/posix.rs index 7634919c100..2b537fb1257 100644 --- a/crates/vm/src/stdlib/posix.rs +++ b/crates/vm/src/stdlib/posix.rs @@ -2567,11 +2567,8 @@ pub mod module { #[pymodule(sub)] mod posix_sched { use crate::{ - AsObject, Py, PyObjectRef, PyResult, VirtualMachine, - builtins::{PyInt, PyTupleRef}, - convert::ToPyObject, - function::FuncArgs, - types::PyStructSequence, + AsObject, Py, PyObjectRef, PyResult, VirtualMachine, builtins::PyTupleRef, + convert::ToPyObject, function::FuncArgs, types::PyStructSequence, }; #[derive(FromArgs)] @@ -2630,7 +2627,10 @@ mod posix_sched { #[cfg(not(target_env = "musl"))] fn convert_sched_param(obj: &PyObjectRef, vm: &VirtualMachine) -> PyResult { - use crate::{builtins::PyTuple, class::StaticType}; + use crate::{ + builtins::{PyInt, PyTuple}, + class::StaticType, + }; if !obj.fast_isinstance(PySchedParam::static_type()) { return Err(vm.new_type_error("must have a sched_param object".to_owned())); } From e006b940b00feecbb7eaf9474b0760de3f80b005 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:12:07 +0100 Subject: [PATCH 04/10] Allow deprecated libc::time_t --- crates/vm/src/stdlib/time.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/vm/src/stdlib/time.rs b/crates/vm/src/stdlib/time.rs index ee19fce7dac..7f20c30db1f 100644 --- a/crates/vm/src/stdlib/time.rs +++ b/crates/vm/src/stdlib/time.rs @@ -998,6 +998,7 @@ mod decl { } #[cfg(any(unix, windows))] + #[cfg_attr(target_env = "musl", allow(deprecated))] fn pyobj_to_time_t(value: Either, vm: &VirtualMachine) -> PyResult { match value { Either::A(float) => { @@ -1005,14 +1006,17 @@ mod decl { return Err(vm.new_value_error("Invalid value for timestamp")); } let secs = float.floor(); + #[cfg_attr(target_env = "musl", allow(deprecated))] if secs < libc::time_t::MIN as f64 || secs > libc::time_t::MAX as f64 { return Err(vm.new_overflow_error("timestamp out of range for platform time_t")); } + #[cfg_attr(target_env = "musl", allow(deprecated))] Ok(secs as libc::time_t) } Either::B(int) => { // try_into is needed on 32-bit platforms where time_t != i64 #[allow(clippy::useless_conversion)] + #[cfg_attr(target_env = "musl", allow(deprecated))] let ts: libc::time_t = int.try_into().map_err(|_| { vm.new_overflow_error("timestamp out of range for platform time_t") })?; @@ -1052,6 +1056,7 @@ mod platform { convert::IntoPyException, }; use core::time::Duration; + #[cfg_attr(target_env = "musl", allow(deprecated))] use libc::time_t; use nix::{sys::time::TimeSpec, time::ClockId}; @@ -1200,6 +1205,7 @@ mod platform { #[cfg(not(target_os = "redox"))] #[cfg(any(not(target_vendor = "apple"), target_os = "macos"))] + #[cfg_attr(target_env = "musl", allow(deprecated))] #[pyfunction] fn clock_settime_ns(clk_id: ClockId, time: libc::time_t, vm: &VirtualMachine) -> PyResult<()> { let ts = Duration::from_nanos(time as _).into(); @@ -1369,10 +1375,12 @@ mod platform { } } + #[cfg_attr(target_env = "musl", allow(deprecated))] pub(super) fn current_time_t() -> libc::time_t { unsafe { libc::time(core::ptr::null_mut()) } } + #[cfg_attr(target_env = "musl", allow(deprecated))] pub(super) fn gmtime_from_timestamp( when: libc::time_t, vm: &VirtualMachine, @@ -1390,6 +1398,7 @@ mod platform { )) } + #[cfg_attr(target_env = "musl", allow(deprecated))] pub(super) fn localtime_from_timestamp( when: libc::time_t, vm: &VirtualMachine, From 5535fc55c531135dd6ac47b170406fe4bbc64abe Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:21:41 +0100 Subject: [PATCH 05/10] More --- crates/vm/src/stdlib/time.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/vm/src/stdlib/time.rs b/crates/vm/src/stdlib/time.rs index 7f20c30db1f..3477648c4a7 100644 --- a/crates/vm/src/stdlib/time.rs +++ b/crates/vm/src/stdlib/time.rs @@ -1121,10 +1121,12 @@ mod platform { } } + #[cfg_attr(target_env = "musl", allow(deprecated))] pub(super) fn current_time_t() -> time_t { unsafe { libc::time(core::ptr::null_mut()) } } + #[cfg_attr(target_env = "musl", allow(deprecated))] pub(super) fn gmtime_from_timestamp( when: time_t, vm: &VirtualMachine, @@ -1137,6 +1139,7 @@ mod platform { Ok(struct_time_from_tm(vm, unsafe { out.assume_init() })) } + #[cfg_attr(target_env = "musl", allow(deprecated))] pub(super) fn localtime_from_timestamp( when: time_t, vm: &VirtualMachine, From d7ffb932e239b7f543aab6d337de0eb8bdcdc41b Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:22:52 +0100 Subject: [PATCH 06/10] more --- crates/vm/src/stdlib/os.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/vm/src/stdlib/os.rs b/crates/vm/src/stdlib/os.rs index fd03be9175e..0736ca18032 100644 --- a/crates/vm/src/stdlib/os.rs +++ b/crates/vm/src/stdlib/os.rs @@ -1226,12 +1226,15 @@ pub(super) mod _os { pub st_gid: PyIntRef, pub st_size: PyIntRef, // Indices 7-9: integer seconds + #[cfg_attr(target_env = "musl", allow(deprecated))] #[pyarg(positional, default)] #[pystruct_sequence(unnamed)] pub st_atime_int: libc::time_t, + #[cfg_attr(target_env = "musl", allow(deprecated))] #[pyarg(positional, default)] #[pystruct_sequence(unnamed)] pub st_mtime_int: libc::time_t, + #[cfg_attr(target_env = "musl", allow(deprecated))] #[pyarg(positional, default)] #[pystruct_sequence(unnamed)] pub st_ctime_int: libc::time_t, From 97280062bfe439817ae29c91e90f3d6d71f69278 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:23:34 +0100 Subject: [PATCH 07/10] More --- crates/vm/src/stdlib/posix.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/vm/src/stdlib/posix.rs b/crates/vm/src/stdlib/posix.rs index 2b537fb1257..69b727d09dd 100644 --- a/crates/vm/src/stdlib/posix.rs +++ b/crates/vm/src/stdlib/posix.rs @@ -2654,6 +2654,7 @@ mod posix_sched { } } + #[cfg(not(target_env = "musl"))] #[derive(FromArgs)] struct SchedSetschedulerArgs { #[pyarg(positional)] @@ -2693,6 +2694,7 @@ mod posix_sched { )) } + #[cfg(not(target_env = "musl"))] #[derive(FromArgs)] struct SchedSetParamArgs { #[pyarg(positional)] From 4d3a8a4bbdb91db2e5317ffac8d69ad931710c78 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:52:40 +0100 Subject: [PATCH 08/10] Try to add cfg_attr at struct --- crates/vm/src/stdlib/os.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/vm/src/stdlib/os.rs b/crates/vm/src/stdlib/os.rs index 0736ca18032..1ede61a7345 100644 --- a/crates/vm/src/stdlib/os.rs +++ b/crates/vm/src/stdlib/os.rs @@ -1215,6 +1215,7 @@ pub(super) mod _os { } } + #[cfg_attr(target_env = "musl", allow(deprecated))] #[derive(Debug, FromArgs)] #[pystruct_sequence_data] struct StatResultData { From 9ffaaa713347c47136e19d94338b8390bcba73e4 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:25:24 +0100 Subject: [PATCH 09/10] Fix for android --- crates/stdlib/src/compression.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/stdlib/src/compression.rs b/crates/stdlib/src/compression.rs index 8cc48b74782..ae47ebbff70 100644 --- a/crates/stdlib/src/compression.rs +++ b/crates/stdlib/src/compression.rs @@ -296,7 +296,8 @@ impl DecompressState { self.eof } - pub fn decompressor(&self) -> &D { + #[cfg_attr(target_os = "android", allow(dead_code))] + pub const fn decompressor(&self) -> &D { &self.decompress } From 6f597bdeda12baa0ee04a5758418132d62a781fc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 27 Feb 2026 12:46:40 +0000 Subject: [PATCH 10/10] Auto-format: ruff format --- extra_tests/snippets/stdlib_io.py | 1 + 1 file changed, 1 insertion(+) diff --git a/extra_tests/snippets/stdlib_io.py b/extra_tests/snippets/stdlib_io.py index f1e682b5d24..25985e08968 100644 --- a/extra_tests/snippets/stdlib_io.py +++ b/extra_tests/snippets/stdlib_io.py @@ -41,6 +41,7 @@ nres = fio.read(2) assert len(nres) == 2 + # Test that IOBase.isatty() raises ValueError when called on a closed file. # Minimal subclass that inherits IOBase.isatty() without overriding it. class MinimalRaw(RawIOBase):