Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
9 changes: 9 additions & 0 deletions crates/vm/src/stdlib/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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),
Expand All @@ -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,
}
}
}
Expand Down
Loading