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

scandir direntry.stat() always returns st_ctime of 0 on Windows #117267

Closed
Assignees
zooba
Labels
3.12only security fixes3.13bugs and security fixesOS-windowstype-bugAn unexpected behavior, bug, or error
@ppixiv

Description

@ppixiv

Bug report

Bug description:

In 3.12 on Windows, calling stat() on a direntry returned from os.scandir() always returns an st_ctime of 0:

importosfordirentryinos.scandir('.'):st=direntry.stat()print(st.st_ctime)

In 3.10, this gave reasonable timestamps. In 3.12, it's always 0. This only affects os.scandir, not os.stat. I'm guessing it's related to this (https://docs.python.org/3/whatsnew/3.12.html#deprecated):

"The st_ctime fields return byos.stat() andos.lstat() on Windows are deprecated. In a future release, they will contain the last metadata change time, consistent with other platforms. For now, they still contain the creation time, which is also available in the new st_birthtime field. (Contributed by Steve Dower ingh-99726.)"

The os.stat results are as described, but maybe direntry.stat() was overlooked. I think it should also give st_ctime = st_birthtime for the compatibility period, like os.stat() is doing, not 0.

CPython versions tested on:

3.12

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixesOS-windowstype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp