8000 Merge branch 'RustPython:main' into libffi-upgrade · RustPython/RustPython@b10ec4c · GitHub
[go: up one dir, main page]

Skip to content

Commit b10ec4c

Browse files
authored
Merge branch 'RustPython:main' into libffi-upgrade
2 parents f442e67 + 5e682e3 commit b10ec4c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

compiler/literal/src/float.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub fn format_fixed(precision: usize, magnitude: f64, case: Case, alternate_form
5555
match magnitude {
5656
magnitude if magnitude.is_finite() => {
5757
let point = decimal_point_or_empty(precision, alternate_form);
58+
let precision = std::cmp::min(precision, u16::MAX as usize);
5859
format!("{magnitude:.precision$}{point}")
5960
}
6061
magnitude if magnitude.is_nan() => format_nan(case),

vm/src/stdlib/io.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ mod _io {
259259
}
260260

261261
fn write(&mut self, data: &[u8]) -> Option<u64> {
262+
if data.is_empty() {
263+
return Some(0);
264+
}
262265
let length = data.len();
263266
self.cursor.write_all(data).ok()?;
264267
Some(length as u64)

0 commit comments

Comments
 (0)
0