Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-99726: Improves correctness of stat results for Windows, and uses faster API when available #102149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 16, 2023
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
Prev Previous commit
Next Next commit
Store correct birthtime value
  • Loading branch information
zooba committed Mar 14, 2023
commit de1146878ba52f5791c3f12a666eb1ac57effcde
9 changes: 9 additions & 0 deletions 9 Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,15 @@ def trunc(x): return x
nanosecondy = getattr(result, name + "_ns") // 10000
self.assertAlmostEqual(floaty, nanosecondy, delta=2)

# Ensure both birthtime and birthtime_ns roughly agree, if present
try:
floaty = int(result.st_birthtime * 100000)
nanosecondy = result.st_birthtime_ns // 10000
except AttributeError:
pass
else:
self.assertAlmostEqual(floaty, nanosecondy, delta=2)

try:
result[200]
self.fail("No exception raised")
Expand Down
2 changes: 1 addition & 1 deletion 2 Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2528,7 +2528,7 @@ _pystat_fromstructstat(PyObject *module, STRUCT_STAT *st)
val);
}
#elif defined(MS_WINDOWS)
fill_time(module, v, ST_BIRTHTIME_IDX, -1, ST_BIRTHTIME_NS_IDX,
fill_time(module, v, -1, ST_BIRTHTIME_IDX, ST_BIRTHTIME_NS_IDX,
st->st_birthtime, st->st_birthtime_nsec);
#endif
#ifdef HAVE_STRUCT_STAT_ST_FLAGS
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.