8000 Update deps (#5417) · RustPython/RustPython@37dc28a · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 37dc28a

Browse files
authored
Update deps (#5417)
* Upgrade nix * Update deps * Upgrade pyo3, winreg * Fix errors from upgrading
1 parent 7623668 commit 37dc28a

File tree

17 files changed

+575
-705
lines changed

17 files changed

+575
-705
lines changed

Cargo.lock

Lines changed: 491 additions & 639 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ rustyline = { workspace = true }
4949

5050
[dev-dependencies]
5151
criterion = { version = "0.3.5", features = ["html_reports"] }
52-
pyo3 = { version = "0.20.2", features = ["auto-initialize"] }
52+
pyo3 = { version = "0.22", features = ["auto-initialize"] }
5353

5454
[[bench]]
5555
name = "execution"
@@ -105,7 +105,7 @@ members = [
105105
version = "0.4.0"
106106
authors = ["RustPython Team"]
107107
edition = "2021"
108-
rust-version = "1.78.0"
108+
rust-version = "1.80.0"
109109
repository = "https://github.com/RustPython/RustPython"
110110
license = "MIT"
111111

@@ -143,7 +143,7 @@ ahash = "0.8.11"
143143
ascii = "1.0"
144144
atty = "0.2.14"
145145
bitflags = "2.4.1"
146-
bstr = "0.2.17"
146+
bstr = "1"
147147
cfg-if = "1.0"
148148
chrono = "0.4.37"
149149
crossbeam-utils = "0.8.19"
@@ -158,7 +158,7 @@ is-macro = "0.3.0"
158158
junction = "1.0.0"
159159
libc = "0.2.153"
160160
log = "0.4.16"
161-
nix = { version = "0.27", features = ["fs", "user", "process", "term", "time", "signal", "ioctl", "socket", "sched", "zerocopy", "dir", "hostname", "net", "poll"] }
161+
nix = { version = "0.29", features = ["fs", "user", "process", "term", "time", "signal", "ioctl", "socket", "sched", "zerocopy", "dir", "hostname", "net", "poll"] }
162162
malachite-bigint = "0.2.0"
163163
malachite-q = "0.4.4"
164164
malachite-base = "0.4.4"
@@ -176,6 +176,8 @@ rustyline = "14.0.0"
176176
serde = { version = "1.0.133", default-features = false }
177177
schannel = "0.1.22"
178178
static_assertions = "1.1"
179+
strum = "0.26"
180+
strum_macros = "0.26"
179181
syn = "1.0.109"
180182
thiserror = "1.0"
181183
thread_local = "1.1.4"

benches/execution.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use std::path::Path;
1313
fn bench_cpython_code(b: &mut Bencher, source: &str) {
1414
pyo3::Python::with_gil(|py| {
1515
b.iter(|| {
16-
let module =
17-
pyo3::types::PyModule::from_code(py, source, "", "").expect("Error running source");
16+
let module = pyo3::types::PyModule::from_code_bound(py, source, "", "")
17+
.expect("Error running source");
1818
black_box(module);
1919
})
2020
})
@@ -53,9 +53,10 @@ pub fn benchmark_file_parsing(group: &mut BenchmarkGroup<WallTime>, name: &str,
5353
b.iter(|| ast::Suite::parse(contents, name).unwrap())
5454
});
5555
group.bench_function(BenchmarkId::new("cpython", name), |b| {
56+
use pyo3::types::PyAnyMethods;
5657
pyo3::Python::with_gil(|py| {
57-
let builtins =
58-
pyo3::types::PyModule::import(py, "builtins").expect("Failed to import builtins");
58+
let builtins = pyo3::types::PyModule::import_bound(py, "builtins")
59+
.expect("Failed to import builtins");
5960
let compile = builtins.getattr("compile").expect("no compile in builtins");
6061
b.iter(|| {
6162
let x = compile

benches/microbenchmarks.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use criterion::{
22
criterion_group, criterion_main, measurement::WallTime, BatchSize, BenchmarkGroup, BenchmarkId,
33
Criterion, Throughput,
44
};
5+
use pyo3::types::PyAnyMethods;
56
use rustpython_compiler::Mode;
67
use rustpython_vm::{AsObject, Interpreter, PyResult, Settings};
78
use std::{
@@ -44,25 +45,28 @@ fn bench_cpython_code(group: &mut BenchmarkGroup<WallTime>, bench: &MicroBenchma
4445

4546
// Grab the exec function in advance so we don't have lookups in the hot code
4647
let builtins =
47-
pyo3::types::PyModule::import(py, "builtins").expect("Failed to import builtins");
48+
pyo3::types::PyModule::import_bound(py, "builtins").expect("Failed to import builtins");
4849
let exec = builtins.getattr("exec").expect("no exec in builtins");
4950

50-
let bench_func = |(globals, locals): &mut (&pyo3::types::PyDict, &pyo3::types::PyDict)| {
51-
let res = exec.call((code, &*globals, &*locals), None);
51+
let bench_func = |(globals, locals): &mut (
52+
pyo3::Bound<pyo3::types::PyDict>,
53+
pyo3::Bound<pyo3::types::PyDict>,
54+
)| {
55+
let res = exec.call((&code, &*globals, &*locals), None);
5256
if let Err(e) = res {
5357
e.print(py);
5458
panic!("Error running microbenchmark")
5559
}
5660
};
5761

5862
let bench_setup = |iterations| {
59-
let globals = pyo3::types::PyDict::new(py);
60-
let locals = pyo3::types::PyDict::new(py);
63+
let globals = pyo3::types::PyDict::new_bound(py);
64+
let locals = pyo3::types::PyDict::new_bound(py);
6165
if let Some(idx) = iterations {
6266
globals.set_item("ITERATIONS", idx).unwrap();
6367
}
6468

65-
let res = exec.call((setup_code, &globals, &locals), None);
69+
let res = exec.call((&setup_code, &globals, &locals), None);
6670
if let Err(e) = res {
6771
e.print(py);
6872
panic!("Error running microbenchmark setup code")
@@ -93,9 +97,9 @@ fn cpy_compile_code<'a>(
9397
py: pyo3::Python<'a>,
9498
code: &str,
9599
name: &str,
96-
) -> pyo3::PyResult<&'a pyo3::types::PyCode> {
100+
) -> pyo3::PyResult<pyo3::Bound<'a, pyo3::types::PyCode>> {
97101
let builtins =
98-
pyo3::types::PyModule::import(py, "builtins").expect("Failed to import builtins");
102+
pyo3::types::PyModule::import_bound(py, "builtins").expect("Failed to import builtins");
99103
let compile = builtins.getattr("compile").expect("no compile in builtins");
100104
compile.call1((code, name, "exec"))?.extract()
101105
}

common/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ rustpython-format = { workspace = true }
1616

1717
ascii = { workspace = true }
1818
bitflags = { workspace = true }
19-
bstr = { workspace = true }
2019
cfg-if = { workspace = true }
2120
itertools = { workspace = true }
2221
libc = { workspace = true }

common/src/int.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use bstr::ByteSlice;
21
use malachite_base::{num::conversion::traits::RoundingInto, rounding_modes::RoundingMode};
32
use malachite_bigint::{BigInt, BigUint, Sign};
43
use malachite_q::Rational;
@@ -32,7 +31,7 @@ pub fn float_to_ratio(value: f64) -> Option<(BigInt, BigInt)> {
3231

3332
pub fn bytes_to_int(lit: &[u8], mut base: u32) -> Option<BigInt> {
3433
// split sign
35-
let mut lit = lit.trim();
34+
let mut lit = lit.trim_ascii();
3635
let sign = match lit.first()? {
3736
b'+' => Some(Sign::Plus),
3837
b'-' => Some(Sign::Minus),

common/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! A crate to hold types and 10000 functions common to all rustpython components.
22
3+
#![cfg_attr(target_os = "redox", feature(byte_slice_trim_ascii))]
4+
35
#[macro_use]
46
mod macros;
57
pub use macros::*;

stdlib/src/socket.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,15 +1842,16 @@ mod _socket {
18421842
#[cfg(unix)]
18431843
{
18441844
use nix::poll::*;
1845+
use std::os::fd::AsFd;
18451846
let events = match kind {
18461847
SelectKind::Read => PollFlags::POLLIN,
18471848
SelectKind::Write => PollFlags::POLLOUT,
18481849
SelectKind::Connect => PollFlags::POLLOUT | PollFlags::POLLERR,
18491850
};
1850-
let mut pollfd = [PollFd::new(sock, events)];
1851+
let mut pollfd = [PollFd::new(sock.as_fd(), events)];
18511852
let timeout = match interval {
1852-
Some(d) => d.as_millis() as _,
1853-
None => -1,
1853+
Some(d) => d.try_into().unwrap_or(PollTimeout::MAX),
1854+
None => PollTimeout::NONE,
18541855
};
18551856
let ret = poll(&mut pollfd, timeout)?;
18561857
Ok(ret == 0)

vm/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ memchr = { workspace = true }
7474

7575
caseless = "0.2.1"
7676
flamer = { version = "0.4", optional = true }
77-
half = "1.8.2"
77+
half = "2"
7878
memoffset = "0.9.1"
7979
optional = "0.5.0"
8080
result-like = "0.4.6"
@@ -94,12 +94,12 @@ unic-ucd-ident = "0.9.0"
9494
rustix = { workspace = true }
9595
exitcode = "1.1.2"
9696
uname = "0.1.1"
97-
strum = "0.24.0"
98-
strum_macros = "0.24.0"
97+
strum = { workspace = true }
98+
strum_macros = { workspace = true }
9999

100100
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
101101
rustyline = { workspace = true }
102-
which = "4.2.5"
102+
which = "6"
103103

104104
[target.'cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))'.dependencies]
105105
num_cpus = "1.13.1"
@@ -108,7 +108,7 @@ num_cpus = "1.13.1"
108108
junction = { workspace = true }
109109
schannel = { workspace = true }
110110
widestring = { workspace = true }
111-
winreg = "0.10.1"
111+
winreg = "0.52"
112112

113113
[target.'cfg(windows)'.dependencies.windows]
114114
version = "0.52.0"
@@ -152,4 +152,4 @@ itertools = { workspace = true }
152152
rustc_version = "0.4.0"
153153

154154
[lints]
155-
workspace = true
155+
workspace = true

vm/src/buffer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,8 @@ make_pack_float!(f64);
540540
impl Packable for f16 {
541541
fn pack<E: ByteOrder>(vm: &VirtualMachine, arg: PyObjectRef, data: &mut [u8]) -> PyResult<()> {
542542
let f_64 = *ArgIntoFloat::try_from_object(vm, arg)?;
543-
let f_16 = f16::from_f64(f_64);
543+
// "from_f64 should be preferred in any non-`const` context" except it gives the wrong result :/
544+
let f_16 = f16::from_f64_const(f_64);
544545
if f_16.is_infinite() != f_64.is_infinite( 4311 ) {
545546
return Err(vm.new_overflow_error("float too large to pack with e format".to_owned()));
546547
}

0 commit comments

Comments
 (0)
0