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

python 3.12: os.fstat() raises WinError 87 #19

Closed
jknockel opened this issue Oct 29, 2023 · 3 comments
Closed

python 3.12: os.fstat() raises WinError 87 #19

jknockel opened this issue Oct 29, 2023 · 3 comments

Comments

@jknockel
Copy link

Here is an example reproducer:

>>> import os
>>> os.stat('c:\\windows\\notepad.exe')
os.stat_result(st_mode=33279, st_ino=281474976770376, st_dev=3158229071, st_nlink=2, st_uid=0, st_gid=0, st_size=193024, st_atime=1464830981, st_mtime=1464830981, st_ctime=1464830981)
>>> f = open('c:\\windows\\notepad.exe', 'rb')
>>> f.fileno()
3
>>> os.fstat(f.fileno())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [WinError 87] The parameter is incorrect

I did not observe this issue with python 3.11.

@adang1345
Copy link
Owner

I suspect that python/cpython#102149 may have introduced an incompatibility with Windows 7. I'll see if I can add a patch that fixes this.

@adang1345
Copy link
Owner

It turns out that this bug is not isolated to Windows 7. Any file system or OS that does not support the FileIdInfo argument to GetFileInformationByHandleEx() will trigger this error. The error happens on Windows 7 because the OS does not support FileIdInfo. The error also happens on recent versions of Windows with the official Python 3.12.0 release if the file is on a FAT32 or exFAT file system.

I reported the bug at python/cpython#111856. In the meantime I will rebuild Python 3.12.0 with a fix.

@adang1345
Copy link
Owner

I have uploaded a fixed version of Python 3.12.0.

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

No branches or pull requests

2 participants