Skip to content

[3.14] gh-140774: Fix clearing the read-only file attribute on Windows (GH-154852) - #161898

Merged
serhiy-storchaka merged 1 commit into
python:3.14from
serhiy-storchaka:backport-46d437d-3.14
Nov 12, 2026
Merged

serhiy-storchaka merged 1 commit into
python:3.14from
serhiy-storchaka:backport-46d437d-3.14

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

(cherry picked from commit 46d437d)

Co-authored-by: Yusuke Hayashi yusuke8h@gmail.com

🤖 Generated with Claude Code

…Windows (pythonGH-154852)

SetFileInformationByHandle() interprets a FILE_BASIC_INFO with
FileAttributes == 0 as "leave the attributes unchanged", so clearing
the read-only flag of a file with no other attribute set was silently
ignored by os.chmod(follow_symlinks=True), os.fchmod() and
pathlib.Path.chmod().  Substitute FILE_ATTRIBUTE_NORMAL in that case.
(cherry picked from commit 46d437d)

Co-authored-by: Yusuke Hayashi <yusuke8h@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants