-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-144050: Fix stat.filemode pure Python file type detection #144059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <storchaka@gmail.com>
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
|
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. |
…ythonGH-144059) (cherry picked from commit fe62926) Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
…ythonGH-144059) (cherry picked from commit fe62926) Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
|
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. |
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