mirror of
https://github.com/python/cpython
synced 2024-10-14 10:33:27 +00:00
gh-117267: Ensure DirEntry.stat().st_ctime still contains creation time during deprecation period (GH-117354)
This commit is contained in:
parent
2057c92125
commit
985917dc8d
|
@ -0,0 +1,5 @@
|
|||
Ensure ``DirEntry.stat().st_ctime`` behaves consistently with
|
||||
:func:`os.stat` during the deprecation period of ``st_ctime`` by containing
|
||||
the same value as ``st_birthtime``. After the deprecation period,
|
||||
``st_ctime`` will be the metadata change time (or unavailable through
|
||||
``DirEntry``), and only ``st_birthtime`` will contain the creation time.
|
|
@ -15830,6 +15830,10 @@ DirEntry_from_find_data(PyObject *module, path_t *path, WIN32_FIND_DATAW *dataW)
|
|||
find_data_to_file_info(dataW, &file_info, &reparse_tag);
|
||||
_Py_attribute_data_to_stat(&file_info, reparse_tag, NULL, NULL, &entry->win32_lstat);
|
||||
|
||||
/* ctime is only deprecated from 3.12, so we copy birthtime across */
|
||||
entry->win32_lstat.st_ctime = entry->win32_lstat.st_birthtime;
|
||||
entry->win32_lstat.st_ctime_nsec = entry->win32_lstat.st_birthtime_nsec;
|
||||
|
||||
return (PyObject *)entry;
|
||||
|
||||
error:
|
||||
|
|
Loading…
Reference in a new issue