Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
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.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Library/2026-01-20-16-35-55.gh-issue-144050.0kKFbF.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…kKFbF.rstCo-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. 👍
fe62926 intopython:mainUh oh!
There was an error while loading.Please reload this page.
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 commitfe62926)Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
…ythonGH-144059)(cherry picked from commitfe62926)Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
GH-144073 is a backport of this pull request to the3.14 branch. |
GH-144074 is a backport of this pull request to the3.13 branch. |
Uh oh!
There was an error while loading.Please reload this page.
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