Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

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

Closed
ntninja wants to merge7 commits intopython:mainfromntninja:fix-issue-39533

Conversation

@ntninja
Copy link

@ntninjantninja commentedMar 23, 2020
edited by bedevere-appbot
Loading

Still missing tests, but I'd appreciate feedback on the changes themselves in the meantime. Also ideas for properly testingbtime would be appreciated.

#83714

jbosboom, SebAlbert, efiop, and landcaster reacted with thumbs up emoji
@ghost
Copy link

ghost commentedSep 12, 2022
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

@alexander255alexander255mannequin mentioned this pull requestSep 12, 2022
@ntninjantninjaforce-pushed thefix-issue-39533 branch 3 times, most recently from667ece4 to4d1edccCompareSeptember 13, 2022 00:44
On 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).
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

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
Copy link
Member

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
Copy link
Contributor

Could this be performance checked against the existingstat? 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 likehttps://lwn.net/Articles/944214/ where the different variants ofstat have quite a bit of performance delta.

@gpshead
Copy link
Member

gpshead commentedAug 31, 2025
edited
Loading

Another take on this: How about not modifyingos.stat behavior at all but instead introduce anos.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.

Theos module is all about providing wrappers around the underlying platform APIs.
(edit: raised this question on the issue)

cmaloney reacted with thumbs up emojihydrargyrum reacted with thumbs down emoji

@gpsheadgpshead changed the titlebpo-39533: Usestatx on more recent Linux to exposest_flags andst_btime on all platformsgh-83714: Usestatx on more recent Linux to exposest_flags andst_btime on all platformsAug 31, 2025
@vstinner
Copy link
Member

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.

os.statx() has been added. This PR is now outdated, I close it. There is a discussion on using os.statx() in pathlib.

cmaloney reacted with hooray emoji

@vstinner
Copy link
Member

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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@gpsheadgpsheadgpshead approved these changes

+2 more reviewers

@SebAlbertSebAlbertSebAlbert left review comments

@ExplodingCabbageExplodingCabbageExplodingCabbage left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

9 participants

@ntninja@cmaloney@gpshead@vstinner@SebAlbert@ExplodingCabbage@the-knights-who-say-ni@ezio-melotti@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp