| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
On BSD/macOS this uses the value of `st_birthtime` (which remains for compatibity 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 have any fallback to plain stat for older kernels and Linux 4.11 is still fairly recent. The configure checks also ensure that the C library expose the proper 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.
typo - "were" should be "where"
Sorry, something went wrong.
| STATX_ATTR_VERITY | ||
| STATX_ATTR_DAX | ||
|
|
||
| .. versionadded:: 3.12 |
There was a problem hiding this comment.
tip - update version markers in docs to "next" and it'll automagically use the right version.
Sorry, something went wrong.
|
Could this be performance checked against the existing stat? Stat is called a lot (in Python 3.14 on linux once for every file opened which includes imports by default) and my worry is issues like https://lwn.net/Articles/944214/ where the different variants of stat have quite a bit of performance delta. |
Sorry, something went wrong.
|
Another take on this: How about not modifying os.stat behavior at all but instead introduce an os.statx API that uses the more modern system call when available and exposes its functionality - in particular the mask functionality so that people can call it and get only the specific data they want instead of a large everything-bagel os.stat result. The os module is all about providing wrappers around the underlying platform APIs. |
Sorry, something went wrong.
os.statx() has been added. This PR is now outdated, I close it. There is a discussion on using os.statx() in pathlib. |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Still missing tests, but I'd appreciate feedback on the changes themselves in the meantime. Also ideas for properly testing btime would be appreciated.
#83714