diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index e751b6423d..054472bcb9 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -714,7 +714,6 @@ def check_file_attributes(self, result): 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 88ca66ac7a..df279bd965 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -223,7 +223,6 @@ def test_addsitedir_hidden_flags(self): 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 45d4e41bcb..9ac84faa40 100644 --- a/crates/vm/src/stdlib/os.rs +++ b/crates/vm/src/stdlib/os.rs @@ -778,6 +778,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 { @@ -812,6 +815,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), @@ -830,6 +838,7 @@ pub(super) mod _os { st_mtime_ns: to_ns(mtime), st_ctime_ns: to_ns(ctime), st_reparse_tag, + st_file_attributes, } } }