Skip to content

Windows: os.stat() returns random times on ERROR_ACCESS_DENIED #114273

Closed as not planned
@danny0838

Description

@danny0838

Bug report

Bug description:

When retrieving the timestamp of an inaccessible file (or directory) in Windows, such as:

os.path.getmtime('C:\\System Volume Information')

, a negative value such as -11644246396.230042 is returned in Python 3.12.

In Python < 3.12, a normal timestamp such as 1705600376.5800736 is returned instead.

This may break many scripts as most of them don't expect a negative value.

CPython versions tested on:

3.12

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowstype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions