Skip to content

Commit c8f86e6

Browse files
committed
st_file_attributes
1 parent a3d638a commit c8f86e6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Lib/test/test_os.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,6 @@ def check_file_attributes(self, result):
714714
self.assertTrue(isinstance(result.st_file_attributes, int))
715715
self.assertTrue(0 <= result.st_file_attributes <= 0xFFFFFFFF)
716716

717-
@unittest.expectedFailureIfWindows('TODO: RUSTPYTHON; os.stat return value doesnt have st_file_attributes attribute')
718717
@unittest.skipUnless(sys.platform == "win32",
719718
"st_file_attributes is Win32 specific")
720719
def test_file_attributes(self):

crates/vm/src/stdlib/os.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,9 @@ pub(super) mod _os {
778778
#[pyarg(any, default)]
779779
#[pystruct_sequence(skip)]
780780
pub st_reparse_tag: u32,
781+
#[pyarg(any, default)]
782+
#[pystruct_sequence(skip)]
783+
pub st_file_attributes: u32,
781784
}
782785

783786
impl StatResultData {
@@ -812,6 +815,11 @@ pub(super) mod _os {
812815
#[cfg(not(windows))]
813816
let st_reparse_tag = 0;
814817

818+
#[cfg(windows)]
819+
let st_file_attributes = stat.st_file_attributes;
820+
#[cfg(not(windows))]
821+
let st_file_attributes = 0;
822+
815823
Self {
816824
st_mode: vm.ctx.new_pyref(stat.st_mode),
817825
st_ino: vm.ctx.new_pyref(stat.st_ino),
@@ -830,6 +838,7 @@ pub(super) mod _os {
830838
st_mtime_ns: to_ns(mtime),
831839
st_ctime_ns: to_ns(ctime),
832840
st_reparse_tag,
841+
st_file_attributes,
833842
}
834843
}
835844
}

0 commit comments

Comments
 (0)