[New-bugs-announce] [issue23634] os.fdopen reopening a read-only fd on windows

mattip report at bugs.python.org
Tue Mar 10 23:41:49 CET 2015


New submission from mattip:

If I have a read-only fd, and I try to open it as 'w' with 

os.fdopen(fd, 'w'), 

the operation raises on linux but succeeds on windows. Python relies on the underlying clib's fdopen to return an error, which glibc does, but MSVC happily closes the original fd and returns with no error.

Would a patch to fix this be welcomed? A test demonstrating the issue is attached. The fix would be to check that the mode requested matches the mode of the argument fd.

Related issues #22259 and #21191 did not consider this case

----------
components: Windows
files: test_openfd.py
messages: 237818
nosy: mattip, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.fdopen reopening a read-only fd on windows
Added file: http://bugs.python.org/file38430/test_openfd.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23634>
_______________________________________


More information about the New-bugs-announce mailing list