Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7eb361c

Browse filesBrowse files
committed
Upgrade which and rustix
1 parent 2e26076 commit 7eb361c
Copy full SHA for 7eb361c

File tree

4 files changed

+32
-41
lines changed
Filter options

4 files changed

+32
-41
lines changed

‎Cargo.lock

Copy file name to clipboardExpand all lines: Cargo.lock
+15-28Lines changed: 15 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

Copy file name to clipboardExpand all lines: Cargo.toml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ proc-macro2 = "1.0.93"
186186
quote = "1.0.38"
187187
rand = "0.9"
188188
rand_core = { version = "0.9", features = ["os_rng"] }
189-
rustix = { version = "0.38", features = ["event"] }
189+
rustix = { version = "1.0", features = ["event"] }
190190
rustyline = "15.0.0"
191191
serde = { version = "1.0.133", default-features = false }
192192
schannel = "0.1.27"

‎stdlib/src/select.rs

Copy file name to clipboardExpand all lines: stdlib/src/select.rs
+15-11Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ mod decl {
519519
use rustix::event::epoll::{self, EventData, EventFlags};
520520
use std::ops::Deref;
521521
use std::os::fd::{AsRawFd, IntoRawFd, OwnedFd};
522-
use std::time::{Duration, Instant};
522+
use std::time::Instant;
523523

524524
#[pyclass(module = "select", name = "epoll")]
525525
#[derive(Debug, rustpython_vm::PyPayload)]
@@ -636,12 +636,11 @@ mod decl {
636636
let poll::TimeoutArg(timeout) = args.timeout;
637637
let maxevents = args.maxevents;
638638

639-
let make_poll_timeout = |d: Duration| i32::try_from(d.as_millis());
640-
let mut poll_timeout = match timeout {
641-
Some(d) => make_poll_timeout(d)
642-
.map_err(|_| vm.new_overflow_error("timeout is too large".to_owned()))?,
643-
None => -1,
644-
};
639+
let mut poll_timeout =
640+
timeout
641+
.map(rustix::event::Timespec::try_from)
642+
.transpose()
643+
.map_err(|_| vm.new_overflow_error("timeout is too large".to_owned()))?;
645644

646645
let deadline = timeout.map(|d| Instant::now() + d);
647646
let maxevents = match maxevents {
@@ -654,19 +653,24 @@ mod decl {
654653
_ => maxevents as usize,
655654
};
656655

657-
let mut events = epoll::EventVec::with_capacity(maxevents);
656+
let mut events = Vec::<epoll::Event>::with_capacity(maxevents);
658657

659658
let epoll = &*self.get_epoll(vm)?;
660659

661660
loop {
662-
match epoll::wait(epoll, &mut events, poll_timeout) {
663-
Ok(()) => break,
661+
events.clear();
662+
match epoll::wait(
663+
epoll,
664+
rustix::buffer::spare_capacity(&mut events),
665+
poll_timeout.as_ref(),
666+
) {
667+
Ok(_) => break,
664668
Err(rustix::io::Errno::INTR) => vm.check_signals()?,
665669
Err(e) => return Err(e.into_pyexception(vm)),
666670
}
667671
if let Some(deadline) = deadline {
668672
if let Some(new_timeout) = deadline.checked_duration_since(Instant::now()) {
669-
poll_timeout = make_poll_timeout(new_timeout).unwrap();
673+
poll_timeout = Some(new_timeout.try_into().unwrap());
670674
} else {
671675
break;
672676
}

‎vm/Cargo.toml

Copy file name to clipboardExpand all lines: vm/Cargo.toml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ uname = "0.1.1"
101101

102102
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
103103
rustyline = { workspace = true }
104-
which = "6"
104+
which = "7"
105105
errno = "0.3"
106106
widestring = { workspace = true }
107107

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.