gh-144050: Fix stat.filemode pure Python file type detection#144059
Merged
serhiy-storchaka merged 4 commits intopython:mainfrom Jan 20, 2026
Merged
gh-144050: Fix stat.filemode pure Python file type detection#144059serhiy-storchaka merged 4 commits intopython:mainfrom
serhiy-storchaka merged 4 commits intopython:mainfrom
Conversation
Member
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Please add a NEWS entry.
Misc/NEWS.d/next/Library/2026-01-20-16-35-55.gh-issue-144050.0kKFbF.rst
Outdated
Show resolved
Hide resolved
…kKFbF.rst Co-authored-by: Serhiy Storchaka <[email protected]>
|
Thanks @VanshAgarwal24036 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Thanks @VanshAgarwal24036 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jan 20, 2026
…ythonGH-144059) (cherry picked from commit fe62926) Co-authored-by: VanshAgarwal24036 <[email protected]>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jan 20, 2026
…ythonGH-144059) (cherry picked from commit fe62926) Co-authored-by: VanshAgarwal24036 <[email protected]>
|
GH-144073 is a backport of this pull request to the 3.14 branch. |
|
GH-144074 is a backport of this pull request to the 3.13 branch. |
serhiy-storchaka
pushed a commit
that referenced
this pull request
Jan 20, 2026
…H-144059) (GH-144074) (cherry picked from commit fe62926) Co-authored-by: VanshAgarwal24036 <[email protected]>
serhiy-storchaka
pushed a commit
that referenced
this pull request
Jan 20, 2026
…H-144059) (GH-144073) (cherry picked from commit fe62926) Co-authored-by: VanshAgarwal24036 <[email protected]>
thunder-coding
pushed a commit
to thunder-coding/cpython
that referenced
this pull request
Feb 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a discrepancy between the C and pure Python implementations
of stat.filemode.
The pure Python implementation could misclassify arbitrary bit patterns
(e.g. 32767) as block devices. File type detection now correctly uses
(mode & S_IFMT) for file types, matching the C implementation.
A regression test is added to prevent this issue from recurring.
Fixes #144050
stat.filemode's C and Python implementation #144050