Skip to content

Commit 50ca5c1

Browse files
committed
Merge remote-tracking branch 'upstream/main' into deps-nodevisitor
2 parents b0d938d + e51d6f0 commit 50ca5c1

8 files changed

Lines changed: 38 additions & 19 deletions

File tree

‎Cargo.lock‎

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

‎Cargo.toml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ rustpython-sre_engine = { path = "crates/sre_engine", version = "0.4.0" }
144144
rustpython-wtf8 = { path = "crates/wtf8", version = "0.4.0" }
145145
rustpython-doc = { path = "crates/doc", version = "0.4.0" }
146146

147-
# Ruff tag 0.15.1 is based on commit a2f11d239f91cf8daedb0764ec15fcfe29c5ae6d
147+
# Ruff tag 0.15.4 is based on commit f14edd8661e2803254f89265548c7487f47a09f6
148148
# at the time of this capture. We use the commit hash to ensure reproducible builds.
149-
ruff_python_parser = { git = "https://github.com/astral-sh/ruff.git", rev = "a2f11d239f91cf8daedb0764ec15fcfe29c5ae6d" }
150-
ruff_python_ast = { git = "https://github.com/astral-sh/ruff.git", rev = "a2f11d239f91cf8daedb0764ec15fcfe29c5ae6d" }
151-
ruff_text_size = { git = "https://github.com/astral-sh/ruff.git", rev = "a2f11d239f91cf8daedb0764ec15fcfe29c5ae6d" }
152-
ruff_source_file = { git = "https://github.com/astral-sh/ruff.git", rev = "a2f11d239f91cf8daedb0764ec15fcfe29c5ae6d" }
149+
ruff_python_parser = { git = "https://github.com/astral-sh/ruff.git", rev = "f14edd8661e2803254f89265548c7487f47a09f6" }
150+
ruff_python_ast = { git = "https://github.com/astral-sh/ruff.git", rev = "f14edd8661e2803254f89265548c7487f47a09f6" }
151+
ruff_text_size = { git = "https://github.com/astral-sh/ruff.git", rev = "f14edd8661e2803254f89265548c7487f47a09f6" }
152+
ruff_source_file = { git = "https://github.com/astral-sh/ruff.git", rev = "f14edd8661e2803254f89265548c7487f47a09f6" }
153153

154154
phf = { version = "0.13.1", default-features = false, features = ["macros"]}
155155
ahash = "0.8.12"

‎Lib/test/test_syntax.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,6 @@ def test_except_star_then_except(self):
24502450
r"cannot have both 'except' and 'except\*' on the same 'try'",
24512451
lineno=3, end_lineno=3, offset=1, end_offset=7)
24522452

2453-
@unittest.expectedFailure # TODO: RUSTPYTHON
24542453
def test_empty_line_after_linecont(self):
24552454
# See issue-40847
24562455
s = r"""\

‎crates/stdlib/src/compression.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ impl<D: Decompressor> DecompressState<D> {
296296
self.eof
297297
}
298298

299-
pub fn decompressor(&self) -> &D {
299+
#[cfg_attr(target_os = "android", allow(dead_code))]
300+
pub const fn decompressor(&self) -> &D {
300301
&self.decompress
301302
}
302303

‎crates/vm/src/stdlib/os.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,12 +1226,15 @@ pub(super) mod _os {
12261226
pub st_gid: PyIntRef,
12271227
pub st_size: PyIntRef,
12281228
// Indices 7-9: integer seconds
1229+
#[cfg_attr(target_env = "musl", allow(deprecated))]
12291230
#[pyarg(positional, default)]
12301231
#[pystruct_sequence(unnamed)]
12311232
pub st_atime_int: libc::time_t,
1233+
#[cfg_attr(target_env = "musl", allow(deprecated))]
12321234
#[pyarg(positional, default)]
12331235
#[pystruct_sequence(unnamed)]
12341236
pub st_mtime_int: libc::time_t,
1237+
#[cfg_attr(target_env = "musl", allow(deprecated))]
12351238
#[pyarg(positional, default)]
12361239
#[pystruct_sequence(unnamed)]
12371240
pub st_ctime_int: libc::time_t,

‎crates/vm/src/stdlib/posix.rs‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ pub mod module {
5151
use nix::{
5252
errno::Errno,
5353
fcntl,
54-
sys::signal,
5554
unistd::{self, Gid, Pid, Uid},
5655
};
5756
use rustpython_common::os::ffi::OsStringExt;
@@ -1530,6 +1529,8 @@ pub mod module {
15301529
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))]
15311530
impl PosixSpawnArgs {
15321531
fn spawn(self, spawnp: bool, vm: &VirtualMachine) -> PyResult<libc::pid_t> {
1532+
use nix::sys::signal;
1533+
15331534
use crate::TryFromBorrowedObject;
15341535

15351536
let path = self
@@ -2566,11 +2567,8 @@ pub mod module {
25662567
#[pymodule(sub)]
25672568
mod posix_sched {
25682569
use crate::{
2569-
AsObject, Py, PyObjectRef, PyResult, VirtualMachine,
2570-
builtins::{PyInt, PyTupleRef},
2571-
convert::ToPyObject,
2572-
function::FuncArgs,
2573-
types::PyStructSequence,
2570+
AsObject, Py, PyObjectRef, PyResult, VirtualMachine, builtins::PyTupleRef,
2571+
convert::ToPyObject, function::FuncArgs, types::PyStructSequence,
25742572
};
25752573

25762574
#[derive(FromArgs)]
@@ -2629,7 +2627,10 @@ mod posix_sched {
26292627

26302628
#[cfg(not(target_env = "musl"))]
26312629
fn convert_sched_param(obj: &PyObjectRef, vm: &VirtualMachine) -> PyResult<libc::sched_param> {
2632-
use crate::{builtins::PyTuple, class::StaticType};
2630+
use crate::{
2631+
builtins::{PyInt, PyTuple},
2632+
class::StaticType,
2633+
};
26332634
if !obj.fast_isinstance(PySchedParam::static_type()) {
26342635
return Err(vm.new_type_error("must have a sched_param object".to_owned()));
26352636
}
@@ -2653,6 +2654,7 @@ mod posix_sched {
26532654
}
26542655
}
26552656

2657+
#[cfg(not(target_env = "musl"))]
26562658
#[derive(FromArgs)]
26572659
struct SchedSetschedulerArgs {
26582660
#[pyarg(positional)]
@@ -2692,6 +2694,7 @@ mod posix_sched {
26922694
))
26932695
}
26942696

2697+
#[cfg(not(target_env = "musl"))]
26952698
#[derive(FromArgs)]
26962699
struct SchedSetParamArgs {
26972700
#[pyarg(positional)]

‎crates/vm/src/stdlib/time.rs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,21 +998,25 @@ mod decl {
998998
}
999999

10001000
#[cfg(any(unix, windows))]
1001+
#[cfg_attr(target_env = "musl", allow(deprecated))]
10011002
fn pyobj_to_time_t(value: Either<f64, i64>, vm: &VirtualMachine) -> PyResult<libc::time_t> {
10021003
match value {
10031004
Either::A(float) => {
10041005
if !float.is_finite() {
10051006
return Err(vm.new_value_error("Invalid value for timestamp"));
10061007
}
10071008
let secs = float.floor();
1009+
#[cfg_attr(target_env = "musl", allow(deprecated))]
10081010
if secs < libc::time_t::MIN as f64 || secs > libc::time_t::MAX as f64 {
10091011
return Err(vm.new_overflow_error("timestamp out of range for platform time_t"));
10101012
}
1013+
#[cfg_attr(target_env = "musl", allow(deprecated))]
10111014
Ok(secs as libc::time_t)
10121015
}
10131016
Either::B(int) => {
10141017
// try_into is needed on 32-bit platforms where time_t != i64
10151018
#[allow(clippy::useless_conversion)]
1019+
#[cfg_attr(target_env = "musl", allow(deprecated))]
10161020
let ts: libc::time_t = int.try_into().map_err(|_| {
10171021
vm.new_overflow_error("timestamp out of range for platform time_t")
10181022
})?;
@@ -1052,6 +1056,7 @@ mod platform {
10521056
convert::IntoPyException,
10531057
};
10541058
use core::time::Duration;
1059+
#[cfg_attr(target_env = "musl", allow(deprecated))]
10551060
use libc::time_t;
10561061
use nix::{sys::time::TimeSpec, time::ClockId};
10571062

@@ -1116,10 +1121,12 @@ mod platform {
11161121
}
11171122
}
11181123

1124+
#[cfg_attr(target_env = "musl", allow(deprecated))]
11191125
pub(super) fn current_time_t() -> time_t {
11201126
unsafe { libc::time(core::ptr::null_mut()) }
11211127
}
11221128

1129+
#[cfg_attr(target_env = "musl", allow(deprecated))]
11231130
pub(super) fn gmtime_from_timestamp(
11241131
when: time_t,
11251132
vm: &VirtualMachine,
@@ -1132,6 +1139,7 @@ mod platform {
11321139
Ok(struct_time_from_tm(vm, unsafe { out.assume_init() }))
11331140
}
11341141

1142+
#[cfg_attr(target_env = "musl", allow(deprecated))]
11351143
pub(super) fn localtime_from_timestamp(
11361144
when: time_t,
11371145
vm: &VirtualMachine,
@@ -1200,6 +1208,7 @@ mod platform {
12001208

12011209
#[cfg(not(target_os = "redox"))]
12021210
#[cfg(any(not(target_vendor = "apple"), target_os = "macos"))]
1211+
#[cfg_attr(target_env = "musl", allow(deprecated))]
12031212
#[pyfunction]
12041213
fn clock_settime_ns(clk_id: ClockId, time: libc::time_t, vm: &VirtualMachine) -> PyResult<()> {
12051214
let ts = Duration::from_nanos(time as _).into();
@@ -1369,10 +1378,12 @@ mod platform {
13691378
}
13701379
}
13711380

1381+
#[cfg_attr(target_env = "musl", allow(deprecated))]
13721382
pub(super) fn current_time_t() -> libc::time_t {
13731383
unsafe { libc::time(core::ptr::null_mut()) }
13741384
}
13751385

1386+
#[cfg_attr(target_env = "musl", allow(deprecated))]
13761387
pub(super) fn gmtime_from_timestamp(
13771388
when: libc::time_t,
13781389
vm: &VirtualMachine,
@@ -1390,6 +1401,7 @@ mod platform {
13901401
))
13911402
}
13921403

1404+
#[cfg_attr(target_env = "musl", allow(deprecated))]
13931405
pub(super) fn localtime_from_timestamp(
13941406
when: libc::time_t,
13951407
vm: &VirtualMachine,

‎extra_tests/snippets/stdlib_io.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
nres = fio.read(2)
4242
assert len(nres) == 2
4343

44+
4445
# Test that IOBase.isatty() raises ValueError when called on a closed file.
4546
# Minimal subclass that inherits IOBase.isatty() without overriding it.
4647
class MinimalRaw(RawIOBase):

0 commit comments

Comments
 (0)