Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-83714: Usestatx on more recent Linux to exposest_flags andst_btime on all platforms#19125
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
1c474bf tobd158bbCompareUh oh!
There was an error while loading.Please reload this page.
ghost commentedSep 12, 2022 • edited by ghost
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by ghost
Uh oh!
There was an error while loading.Please reload this page.
667ece4 to4d1edccCompareOn BSD/macOS this uses the value of `st_birthtime` (which remains forcompatibity reasons), on Windows it duplicates the value of `st_ctime`.A Linux implementation is added in subsequent commits.
It cannot be enabled by default because this implementation does not haveany fallback to plain stat for older kernels and Linux 4.11 is still fairlyrecent. The configure checks also ensure that the C library expose theproper stub functions (glibc 2.28+ only).
…D UF_* equivalent as defined by FreeBSD
| Use the ``statx(2)`` system call for:func:`os.stat` under Linux to provide | ||
| cross-platform support for btime (time of file creation) and file | ||
| attributes. On Windows btime is emulated using ctime and both Linux and | ||
| Windows file attributes are converted to their (Free)BSD equivalent were |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
typo - "were" should be "where"
| STATX_ATTR_VERITY | ||
| STATX_ATTR_DAX | ||
| ..versionadded::3.12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
tip - update version markers in docs to "next" and it'll automagically use the right version.
cmaloney commentedAug 30, 2025
Could this be performance checked against the existing |
gpshead commentedAug 31, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Another take on this: How about not modifying The |
statx on more recent Linux to exposest_flags andst_btime on all platformsstatx on more recent Linux to exposest_flags andst_btime on all platformsvstinner commentedOct 21, 2025
os.statx() has been added. This PR is now outdated, I close it. There is a discussion on using os.statx() in pathlib. |
vstinner commentedOct 21, 2025
Thanks@ntninja for your contribution even if it was taken as it is. Exposing new syscalls is non trivial, it takes time to decide how to expose it in Python. |
Uh oh!
There was an error while loading.Please reload this page.
Still missing tests, but I'd appreciate feedback on the changes themselves in the meantime. Also ideas for properly testing
btimewould be appreciated.#83714