diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index df09d81ea..9e422fd16 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -714,7 +714,6 @@ class StatAttributeTests(unittest.TestCase): self.assertTrue(isinstance(result.st_file_attributes, int)) self.assertTrue(0 <= result.st_file_attributes <= 0xFFFFFFFF) - @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON; os.stat return value doesnt have st_file_attributes attribute') @unittest.skipUnless(sys.platform == "win32", "st_file_attributes is Win32 specific") def test_file_attributes(self): diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index 88ca66ac7..df279bd96 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -223,7 +223,6 @@ class HelperFunctionsTests(unittest.TestCase): finally: pth_file.cleanup() - @unittest.expectedFailure # TODO: RUSTPYTHON @unittest.skipUnless(sys.platform == 'win32', 'test needs Windows') @support.requires_subprocess() def test_addsitedir_hidden_file_attribute(self): diff --git a/crates/vm/src/stdlib/os.rs b/crates/vm/src/stdlib/os.rs index f65de9170..321859944 100644 --- a/crates/vm/src/stdlib/os.rs +++ b/crates/vm/src/stdlib/os.rs @@ -801,6 +801,9 @@ pub(super) mod _os { #[pyarg(any, default)] #[pystruct_sequence(skip)] pub st_reparse_tag: u32, + #[pyarg(any, default)] + #[pystruct_sequence(skip)] + pub st_file_attributes: u32, } impl StatResultData { @@ -835,6 +838,11 @@ pub(super) mod _os { #[cfg(not(windows))] let st_reparse_tag = 0; + #[cfg(windows)] + let st_file_attributes = stat.st_file_attributes; + #[cfg(not(windows))] + let st_file_attributes = 0; + Self { st_mode: vm.ctx.new_pyref(stat.st_mode), st_ino: vm.ctx.new_pyref(stat.st_ino), @@ -853,6 +861,7 @@ pub(super) mod _os { st_mtime_ns: to_ns(mtime), st_ctime_ns: to_ns(ctime), st_reparse_tag, + st_file_attributes, } } }