Skip to content

[3.15] gh-84419: Fix the execute permissions in os.stat() on Windows (GH-155392) - #156629

Merged
serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-b7daede-3.15
Oct 9, 2026
Merged

serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-b7daede-3.15

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 30, 2026 •

Copy link
Copy Markdown
Member

Windows strips trailing dots and spaces from the last component of the path, so they should be ignored when guessing the execute permissions from the file extension. The \\?\ prefix disables such normalization.

(cherry picked from commit b7daede)

…ythonGH-155392)

Windows strips trailing dots and spaces from the last component of the path,
so os.stat('spam.bat ') opened the same file as os.stat('spam.bat'), but did
not set the execute permissions in st_mode, because the extension did not
match.  They are now ignored, unless the \\?\ prefix disables the path
normalization.

(cherry picked from commit b7daede)
@serhiy-storchaka
serhiy-storchaka merged commit 1b4d7b5 into python:3.15 Oct 9, 2026
56 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the backport-b7daede-3.15 branch October 9, 2026 17:57
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.

1 participant