GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-83714: Use "stx_" prefix for all os.statx_result members by vstinner · Pull Request #140432 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Oct 21, 2025 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Add os.statx() function #83714

📚 Documentation preview 📚: https://cpython-previews--140432.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
pythongh-83714: Use "stx_" prefix for all os.statx_result members
55db458
@vstinner vstinner added the skip news label Oct 21, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Oct 21, 2025
Add os.statx() function #83714
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 21, 2025
@vstinner

vstinner commented Oct 21, 2025

Copy link
Copy Markdown
Member Author

I'm not convinced that it's a good idea to have os.statx_result which can be used instead of os.stat_result. It's not exactly the same, os.statx_result members can be None.

It's also strange that some statx members have a st_ prefix, whereas others have a stx_ prefix. I read the statx manual page and expect to have only stx_ prefix: same members names.

I don't think that stx_ prefix would prevent using statx() in pathlib in the future.

cc @jbosboom @cmaloney

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cmaloney
cmaloney reviewed Oct 21, 2025
View reviewed changes

@cmaloney cmaloney left a comment

Copy link
Copy Markdown
Contributor

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.

I'm 👍 on this as its evolved. There's too many weird edged cases and just separating entirely makes simpler to reason around.

I think if go forward with this all the stx_ attributes should be explicitly documented rather than refer to stat_result ones of different name. I'm often in a codebase wondering "what is this" and search in page to find; the text note "all the stat members but with a stx_ prefix" would break that

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Doc/library/os.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/os.rst Outdated

@cmaloney cmaloney Oct 21, 2025

Copy link
Copy Markdown
Contributor

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.

I think this should list all the attributes now; doc having people translate in their head rather than see "here's the name I used" seems like it will break "search in page" finding the attributes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vstinner vstinner Oct 21, 2025

Copy link
Copy Markdown
Member Author

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.

Ok, I completed my PR to document all statx_members. It also clarifies which stat_result members are not part of statx_result:

  • st_creator
  • st_file_attributes
  • st_flags
  • st_fstype
  • st_gen
  • st_reparse_tag
  • st_rsize
  • st_type

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cmaloney reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
vstinner added 2 commits October 21, 2025 19:50
@vstinner
Document all statx_result members
1f0a688
Rename stx_birthtime to stx_btime, and rename stx_birthtime_ns to
stx_btime_ns.
@vstinner
Simplify posixmodule.c macros
12c49f7
Remove now redundant MEMBER parameter.
@vstinner

vstinner commented Oct 21, 2025

Copy link
Copy Markdown
Member Author

I updated my PR to document all statx_result members, and I renamed stx_birthtime to stx_btime.

cmaloney reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cmaloney
cmaloney reviewed Oct 21, 2025
View reviewed changes

@cmaloney cmaloney left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

👍 overall; curious @jbosboom thoughts. Appreciate the fixes/tweaks to Linux kernel version availability.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/os.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
Remove comparison to stat_result
f4676e1
@vstinner

vstinner commented Oct 21, 2025

Copy link
Copy Markdown
Member Author

I changed my mind and just removed the comparison to stat_result:

statx_result has all the attributes that stat_result has on Linux, but using stx_ prefix instead of st_. statx_result is not a subclass of stat_result and cannot be used as a tuple.

I don't think that it's useful to compare these two structures, they are different and listing differences is not worth it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jbosboom

jbosboom commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

I think this needlessly complicates code that uses os.statx on Python >= 3.15 and falls back to os.stat on earlier versions, but I guess there won't be any user code doing that if we get the pathlib interface in 3.15 as well, so +0 from me.

@vstinner You've made substantial changes to both the interface and implementation of os.statx. I think you ought to add your name in the blurb for the issue.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
Credit myself in os.statx() doc
895326e
@vstinner
vstinner requested a review from AA-Turner as a code owner October 22, 2025 08:33
@vstinner

vstinner commented Oct 22, 2025

Copy link
Copy Markdown
Member Author

@vstinner You've made substantial changes to both the interface and implementation of os.statx. I think you ought to add your name in the blurb for the issue.

Ok, I added myself to the credits.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner merged commit 7339cf7 into python:main Oct 22, 2025
4 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner deleted the statx_stx branch October 22, 2025 09:48
@bedevere-app bedevere-app Bot removed the awaiting core review label Oct 22, 2025
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
@vstinner @StanFromIreland
pythongh-83714: Use "stx_" prefix for all os.statx_result members (py…
b4b780c
…thon#140432)

Rename stx_birthtime to stx_btime, and rename stx_birthtime_ns to
stx_btime_ns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cmaloney cmaloney cmaloney left review comments
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vstinner @jbosboom @cmaloney
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.