Skip to content
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
Next Next commit
year>=1900 on windows
  • Loading branch information
youknowone committed Dec 12, 2025
commit ad6795ebd840a4f3ae81eeee3812fbca4eee2ade
1 change: 0 additions & 1 deletion Lib/test/test_strftime.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ class Y1900Tests(unittest.TestCase):
a date before 1900 is passed with a format string containing "%y"
"""

@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_y_before_1900(self):
# Issue #13674, #19634
t = (1899, 1, 1, 0, 0, 0, 0, 0, 0)
Expand Down
8 changes: 8 additions & 0 deletions crates/vm/src/stdlib/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,14 @@ mod decl {
use std::fmt::Write;

let instant = t.naive_or_local(vm)?;

// On Windows/AIX/Solaris, %y format with year < 1900 is not supported
#[cfg(any(windows, target_os = "aix", target_os = "solaris"))]
if instant.year() < 1900 && format.as_str().contains("%y") {
let msg = "format %y requires year >= 1900 on Windows";
return Err(vm.new_value_error(msg.to_owned()));
}

let mut formatted_time = String::new();

/*
Expand Down