Skip to content
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

gh-111856: fix os.fstat on windows with fat32 and exfat filesystem #112038

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

aisk
Copy link
Contributor

@aisk aisk commented Nov 13, 2023

The change is just like #104892.

I think this is hard to test this on GHA, since it needs a disk with fat32 or exfat filesystem. I made a test on my local machine, the drive "E://" is a fat32 filesystem.

Test codes:

import os

f = open("e://a.jpg")
print(os.stat(f.fileno()))
f.close()

Before the comit:

C:\Users\xxxxx\Source\cpython>python a.py
Running Debug|x64 interpreter...
Traceback (most recent call last):
  File "C:\Users\xxxxx\Source\cpython\a.py", line 4, in <module>
    print(os.stat(f.fileno()))
          ^^^^^^^^^^^^^^^^^^^
OSError: [WinError 87] 参数错误。: 3
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='e://a.jpg' mode='r' encoding='cp936'>

After the commit:

C:\Users\xxxxx\Source\cpython>python a.py
Running Debug|x64 interpreter...
os.stat_result(st_mode=33206, st_ino=4194592, st_dev=1548577950, st_nlink=1, st_uid=0, st_gid=0, st_size=2812450, st_atime=1699718400, st_mtime=1673715360, st_ctime=-11644473600)

@zooba zooba added the needs backport to 3.12 bug and security fixes label Nov 13, 2023
@zooba zooba merged commit 29af736 into python:main Nov 13, 2023
32 checks passed
@miss-islington-app
Copy link

Thanks @aisk for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 13, 2023
…tem (pythonGH-112038)

(cherry picked from commit 29af736)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Nov 13, 2023

GH-112044 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Nov 13, 2023
zooba pushed a commit that referenced this pull request Nov 13, 2023
…H-112038)

(cherry picked from commit 29af736)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
@aisk aisk deleted the fix-fstat-fat32 branch November 14, 2023 01:19
aisk added a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
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.

2 participants