Skip to content

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

Open
serhiy-storchaka wants to merge 1 commit into
python:3.15from
serhiy-storchaka:backport-b7daede-3.15
Open

[3.15] gh-84419: Fix the execute permissions in os.stat() on Windows (GH-155392)#156629
serhiy-storchaka wants to merge 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant