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 <rep...@bugs.python.org>
<http://bugs.python.org/issue23634>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to