Skip to content
Closed
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
Document st_birthtime fallback behavior
  • Loading branch information
jbosboom committed Sep 15, 2025
commit 5b36cf0e6d93126cb25c7689c9a2513d2a463a81
6 changes: 4 additions & 2 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3225,7 +3225,8 @@
.. versionchanged:: 3.12
``st_birthtime`` is now available on Windows.
.. versionchanged:: next
``st_birthtime`` is now available on Linux.
``st_birthtime`` is now present on Linux. The value will be ``0.0``
on kernel versions < 4.11 or if not supported by the filesystem.

.. attribute:: st_birthtime_ns

Expand All @@ -3235,7 +3236,8 @@

.. versionadded:: 3.12
.. versionchanged:: next
``st_birthtime_ns`` is now available on Linux.
``st_birthtime_ns`` is now present on Linux. The value will be ``0``
on kernel versions < 4.11 or if not supported by the filesystem.

.. note::

Expand Down Expand Up @@ -3375,7 +3377,7 @@

.. function:: statx(path, mask, *, dir_fd=None, follow_symlinks=True, sync=None)

Get the status of a file or file descriptor by performing a :c:func:`statx`

Check warning on line 3380 in Doc/library/os.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:func reference target not found: statx [ref.func]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be able to make the missing c func / struct pieces stop erroring by adding to:

nitpick_ignore = [
(in general try with new things to not add new warnings; are people working on resolving existing sphinx warnings)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Get the status of a file or file descriptor by performing a :c:func:`statx`
Get the status of a file or file descriptor by performing a :c:func:`!statx`

This will also work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running make html and make check as directed by the devguide, I don't see any warnings.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting all the warnings out of the docs build is difficult (there are many warnings in non-changed code which don't matter for PRs; but new ones do); the CI does check for new warnings and attaches them to PRs. I can see some here on the Github UI:

image

system call on the given path. *path* may be specified as either a string or
bytes -- directly or indirectly through the :class:`PathLike` interface --
or as an open file descriptor. *mask* is a combination of the module-level
Expand Down Expand Up @@ -3404,7 +3406,7 @@

.. class:: statx_result

Object whose attributes correspond roughly to the members of the

Check warning on line 3409 in Doc/library/os.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:struct reference target not found: statx [ref.struct]
:c:struct:`statx` structure. It is used for the result of :func:`os.statx`.
:class:`!statx_result` has all of the attributes of :class:`stat_result`
available on Linux, but is not a subclass of :class:`stat_result` nor a
Expand Down
5 changes: 4 additions & 1 deletion Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2816,7 +2816,10 @@ _pystat_fromstructstat(PyObject *module, STRUCT_STAT *st)
#elif defined(HAVE_STATX)
/* We were built with statx support, so stat_result.st_birthtime[_ns]
exists, but we fell back to stat because statx isn't available at
runtime. User programs assume st_birthtime is not None. */
runtime. structseq members are _Py_T_OBJECT (for which NULL means None,
not AttributeError), but user programs assume st_birthtime is not None.
When the statx syscall wrapper is available but the syscall itself is
not, we end up setting the birthtime to 0, so do that here too. */
SET_ITEM(ST_BIRTHTIME_IDX, PyFloat_FromDouble(0.0));
SET_ITEM(ST_BIRTHTIME_NS_IDX, _PyLong_GetZero());
#elif defined(MS_WINDOWS)
Expand Down
Loading