From 99a384a3c7f4f580eef406d0cdca16fe3ff6b7ea Mon Sep 17 00:00:00 2001 From: Noa Date: Wed, 16 Apr 2025 13:35:30 -0500 Subject: [PATCH 1/4] Upgrade radium --- Cargo.lock | 7 +++++-- common/Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ffadb13f6..95e1c19256 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1986,9 +1986,12 @@ checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" [[package]] name = "radium" -version = "0.7.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" +checksum = "db0b76288902db304c864a12046b73d2d895cc34a4bb8137baaeebe9978a072c" +dependencies = [ + "cfg-if", +] [[package]] name = "radix_trie" diff --git a/common/Cargo.toml b/common/Cargo.toml index 299c2875b2..87e1ee118d 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -32,7 +32,7 @@ parking_lot = { workspace = true, optional = true } unicode_names2 = { workspace = true } lock_api = "0.4" -radium = "0.7" +radium = "1.1" siphasher = "1" volatile = "0.3" From 2e260761ae9cc6e3d1bd6c2ec3336cf1e2505c26 Mon Sep 17 00:00:00 2001 From: Noa Date: Wed, 16 Apr 2025 13:43:58 -0500 Subject: [PATCH 2/4] Upgrade criterion --- Cargo.lock | 155 +++++++++++++++++++++++++++-------------------------- Cargo.toml | 2 +- 2 files changed, 79 insertions(+), 78 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 95e1c19256..d66e1bb33b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,6 +57,12 @@ dependencies = [ "libc", ] +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + [[package]] name = "anstream" version = "0.6.18" @@ -143,17 +149,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.4.0" @@ -330,6 +325,33 @@ dependencies = [ "windows-link", ] +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + [[package]] name = "clang-sys" version = "1.8.1" @@ -343,15 +365,29 @@ dependencies = [ [[package]] name = "clap" -version = "2.34.0" +version = "4.5.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "2df961d8c8a0d08aa9945718ccf584145eee3f3aa06cddbeac12933781102e04" dependencies = [ - "bitflags 1.3.2", - "textwrap 0.11.0", - "unicode-width 0.1.14", + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.5.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "132dbda40fb6753878316a489d5a1242a8ef2f0d9e47ba01c951ea8aa7d013a5" +dependencies = [ + "anstyle", + "clap_lex", ] +[[package]] +name = "clap_lex" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" + [[package]] name = "clipboard-win" version = "5.4.0" @@ -599,24 +635,24 @@ dependencies = [ [[package]] name = "criterion" -version = "0.3.6" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" dependencies = [ - "atty", + "anes", "cast", + "ciborium", "clap", "criterion-plot", - "csv", + "is-terminal", "itertools 0.10.5", - "lazy_static 1.5.0", "num-traits", + "once_cell", "oorandom", "plotters", "rayon", "regex", "serde", - "serde_cbor", "serde_derive", "serde_json", "tinytemplate", @@ -625,9 +661,9 @@ dependencies = [ [[package]] name = "criterion-plot" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" dependencies = [ "cast", "itertools 0.10.5", @@ -674,18 +710,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "csv" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" -dependencies = [ - "csv-core", - "itoa", - "ryu", - "serde", -] - [[package]] name = "csv-core" version = "0.1.12" @@ -858,7 +882,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fc2706461e1ee94f55cab2ed2e3d34ae9536cfa830358ef80acff1a3dacab30" dependencies = [ - "lazy_static 0.2.11", + "lazy_static", "serde", "serde_derive", "serde_json", @@ -999,12 +1023,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" -[[package]] -name = "half" -version = "1.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" - [[package]] name = "half" version = "2.5.0" @@ -1032,18 +1050,15 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hermit-abi" -version = "0.3.9" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "fbd780fe5cc30f81464441920d82ac8740e2e46b29a6fad543ddd075229ce37e" [[package]] name = "hex" @@ -1131,6 +1146,17 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "is-terminal" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" +dependencies = [ + "hermit-abi 0.5.0", + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -1248,12 +1274,6 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - [[package]] name = "lexical-parse-float" version = "1.0.5" @@ -2414,7 +2434,7 @@ dependencies = [ "rustpython-doc", "syn 2.0.100", "syn-ext", - "textwrap 0.16.2", + "textwrap", ] [[package]] @@ -2565,7 +2585,7 @@ dependencies = [ "flamer", "getrandom 0.3.2", "glob", - "half 2.5.0", + "half", "hex", "indexmap", "is-macro", @@ -2734,16 +2754,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "serde_cbor" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" -dependencies = [ - "half 1.8.3", - "serde", -] - [[package]] name = "serde_derive" version = "1.0.219" @@ -2948,15 +2958,6 @@ dependencies = [ "libc", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width 0.1.14", -] - [[package]] name = "textwrap" version = "0.16.2" diff --git a/Cargo.toml b/Cargo.toml index 74fdf7464e..fe444b1963 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -155,7 +155,7 @@ bitflags = "2.4.2" bstr = "1" cfg-if = "1.0" chrono = "0.4.39" -criterion = { version = "0.3.5", features = ["html_reports"] } +criterion = { version = "0.5", features = ["html_reports"] } crossbeam-utils = "0.8.21" flame = "0.2.2" getrandom = { version = "0.3", features = ["std"] } From 7eb361c92fabd1e2a5c5405c0d551cd9eca676ef Mon Sep 17 00:00:00 2001 From: Noa Date: Wed, 16 Apr 2025 13:48:21 -0500 Subject: [PATCH 3/4] Upgrade which and rustix --- Cargo.lock | 43 +++++++++++++++---------------------------- Cargo.toml | 2 +- stdlib/src/select.rs | 26 +++++++++++++++----------- vm/Cargo.toml | 2 +- 4 files changed, 32 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d66e1bb33b..ccd224f4f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -818,6 +818,12 @@ dependencies = [ "regex", ] +[[package]] +name = "env_home" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" + [[package]] name = "env_logger" version = "0.11.8" @@ -872,7 +878,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" dependencies = [ "cfg-if", - "rustix 1.0.5", + "rustix", "windows-sys 0.59.0", ] @@ -966,7 +972,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed7131e57abbde63513e0e6636f76668a1ca9798dcae2df4e283cae9ee83859e" dependencies = [ - "rustix 1.0.5", + "rustix", "windows-targets 0.52.6", ] @@ -1396,12 +1402,6 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - [[package]] name = "linux-raw-sys" version = "0.9.3" @@ -2272,19 +2272,6 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags 2.9.0", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - [[package]] name = "rustix" version = "1.0.5" @@ -2294,7 +2281,7 @@ dependencies = [ "bitflags 2.9.0", "errno", "libc", - "linux-raw-sys 0.9.3", + "linux-raw-sys", "windows-sys 0.59.0", ] @@ -2539,7 +2526,7 @@ dependencies = [ "paste", "puruspe", "rand_core 0.9.3", - "rustix 0.38.44", + "rustix", "rustpython-common", "rustpython-derive", "rustpython-vm", @@ -2613,7 +2600,7 @@ dependencies = [ "ruff_python_parser", "ruff_source_file", "ruff_text_size", - "rustix 0.38.44", + "rustix", "rustpython-codegen", "rustpython-common", "rustpython-compiler", @@ -3427,13 +3414,13 @@ dependencies = [ [[package]] name = "which" -version = "6.0.3" +version = "7.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f" +checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762" dependencies = [ "either", - "home", - "rustix 0.38.44", + "env_home", + "rustix", "winsafe", ] diff --git a/Cargo.toml b/Cargo.toml index fe444b1963..621c255175 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -186,7 +186,7 @@ proc-macro2 = "1.0.93" quote = "1.0.38" rand = "0.9" rand_core = { version = "0.9", features = ["os_rng"] } -rustix = { version = "0.38", features = ["event"] } +rustix = { version = "1.0", features = ["event"] } rustyline = "15.0.0" serde = { version = "1.0.133", default-features = false } schannel = "0.1.27" diff --git a/stdlib/src/select.rs b/stdlib/src/select.rs index f89a6c4f03..f600d60ede 100644 --- a/stdlib/src/select.rs +++ b/stdlib/src/select.rs @@ -519,7 +519,7 @@ mod decl { use rustix::event::epoll::{self, EventData, EventFlags}; use std::ops::Deref; use std::os::fd::{AsRawFd, IntoRawFd, OwnedFd}; - use std::time::{Duration, Instant}; + use std::time::Instant; #[pyclass(module = "select", name = "epoll")] #[derive(Debug, rustpython_vm::PyPayload)] @@ -636,12 +636,11 @@ mod decl { let poll::TimeoutArg(timeout) = args.timeout; let maxevents = args.maxevents; - let make_poll_timeout = |d: Duration| i32::try_from(d.as_millis()); - let mut poll_timeout = match timeout { - Some(d) => make_poll_timeout(d) - .map_err(|_| vm.new_overflow_error("timeout is too large".to_owned()))?, - None => -1, - }; + let mut poll_timeout = + timeout + .map(rustix::event::Timespec::try_from) + .transpose() + .map_err(|_| vm.new_overflow_error("timeout is too large".to_owned()))?; let deadline = timeout.map(|d| Instant::now() + d); let maxevents = match maxevents { @@ -654,19 +653,24 @@ mod decl { _ => maxevents as usize, }; - let mut events = epoll::EventVec::with_capacity(maxevents); + let mut events = Vec::::with_capacity(maxevents); let epoll = &*self.get_epoll(vm)?; loop { - match epoll::wait(epoll, &mut events, poll_timeout) { - Ok(()) => break, + events.clear(); + match epoll::wait( + epoll, + rustix::buffer::spare_capacity(&mut events), + poll_timeout.as_ref(), + ) { + Ok(_) => break, Err(rustix::io::Errno::INTR) => vm.check_signals()?, Err(e) => return Err(e.into_pyexception(vm)), } if let Some(deadline) = deadline { if let Some(new_timeout) = deadline.checked_duration_since(Instant::now()) { - poll_timeout = make_poll_timeout(new_timeout).unwrap(); + poll_timeout = Some(new_timeout.try_into().unwrap()); } else { break; } diff --git a/vm/Cargo.toml b/vm/Cargo.toml index 125c263da9..1fdd700b75 100644 --- a/vm/Cargo.toml +++ b/vm/Cargo.toml @@ -101,7 +101,7 @@ uname = "0.1.1" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] rustyline = { workspace = true } -which = "6" +which = "7" errno = "0.3" widestring = { workspace = true } From 2e14b7b5e8c9e4a16bd9e2a60356927e709d6d2b Mon Sep 17 00:00:00 2001 From: Noa Date: Wed, 16 Apr 2025 13:52:23 -0500 Subject: [PATCH 4/4] Upgrade system-configuration and libz-rs-sys --- Cargo.lock | 31 ++++++++----------------------- stdlib/Cargo.toml | 4 ++-- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ccd224f4f7..941b1f97fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -925,7 +925,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" dependencies = [ "crc32fast", - "libz-rs-sys 0.5.0", + "libz-rs-sys", "miniz_oxide", ] @@ -1378,22 +1378,13 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "libz-rs-sys" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "902bc563b5d65ad9bba616b490842ef0651066a1a1dc3ce1087113ffcb873c8d" -dependencies = [ - "zlib-rs 0.4.2", -] - [[package]] name = "libz-rs-sys" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6489ca9bd760fe9642d7644e827b0c9add07df89857b0416ee15c1cc1a3b8c5a" dependencies = [ - "zlib-rs 0.5.0", + "zlib-rs", ] [[package]] @@ -2506,7 +2497,7 @@ dependencies = [ "junction", "libc", "libsqlite3-sys", - "libz-rs-sys 0.4.2", + "libz-rs-sys", "mac_address", "malachite-bigint", "md-5", @@ -2902,20 +2893,20 @@ dependencies = [ [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.9.0", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", @@ -3758,12 +3749,6 @@ dependencies = [ "syn 2.0.100", ] -[[package]] -name = "zlib-rs" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b20717f0917c908dc63de2e44e97f1e6b126ca58d0e391cee86d504eb8fbd05" - [[package]] name = "zlib-rs" version = "0.5.0" diff --git a/stdlib/Cargo.toml b/stdlib/Cargo.toml index d4b99ebc92..eb6b9fe4dd 100644 --- a/stdlib/Cargo.toml +++ b/stdlib/Cargo.toml @@ -79,7 +79,7 @@ ucd = "0.1.1" adler32 = "1.2.0" crc32fast = "1.3.2" flate2 = { version = "1.1", default-features = false, features = ["zlib-rs"] } -libz-sys = { package = "libz-rs-sys", version = "0.4" } +libz-sys = { package = "libz-rs-sys", version = "0.5" } bzip2 = { version = "0.4", optional = true } # tkinter @@ -132,7 +132,7 @@ features = [ ] [target.'cfg(target_os = "macos")'.dependencies] -system-configuration = "0.5.1" +system-configuration = "0.6.1" [lints] workspace = true