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

Miscellaneous deps upgrades #5705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Upgrade which and rustix
  • Loading branch information
coolreader18 committed Apr 16, 2025
commit 7eb361c92fabd1e2a5c5405c0d551cd9eca676ef
43 changes: 15 additions & 28 deletions 43 Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 2 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
26 changes: 15 additions & 11 deletions 26 stdlib/src/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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 {
Expand All @@ -654,19 +653,24 @@ mod decl {
_ => maxevents as usize,
};

let mut events = epoll::EventVec::with_capacity(maxevents);
let mut events = Vec::<epoll::Event>::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;
}
Expand Down
2 changes: 1 addition & 1 deletion 2 vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.