<div dir="ltr">What version of CPython did you compare with? This behavior was added/changed in 2.7.8. CPython has the exact same test and it doesn't seem to be skipped on Windows. Comparing directly with C fdopen does not make sense because os.fdopen isn't just a direct call to fdopen (includes verification of mode, fd, etc).<div><br></div><div><a href="http://bugs.python.org/issue21191">http://bugs.python.org/issue21191</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 21, 2015 at 1:58 PM, Matti Picus <span dir="ltr"><<a href="mailto:matti.picus@gmail.com" target="_blank">matti.picus@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="direction:ltr" bgcolor="#FFFFFF" text="#000000">
Looking at this test test_fdopen_keeps_fd_open_on_errors which fails
on win32<br>
<a href="http://buildbot.pypy.org/summary/longrepr?testname=AppTestPosix.%28%29.test_fdopen_keeps_fd_open_on_errors&builder=own-win-x86-32&build=442&mod=module.posix.test.test_posix2" target="_blank">http://buildbot.pypy.org/summary/longrepr?testname=AppTestPosix.%28%29.test_fdopen_keeps_fd_open_on_errors&builder=own-win-x86-32&build=442&mod=module.posix.test.test_posix2</a><br>
<br>
It also fails when run with python -A, on cpython. It even fails in
C when running the code from the MSDN example of fdopen,<br>
<a href="https://msdn.microsoft.com/en-us/library/dye30d82.aspx" target="_blank">https://msdn.microsoft.com/en-us/library/dye30d82.aspx</a><br>
if you replace the mode flag "r" with "w", windows will happily
repopen a read-only file in write mode.<br>
<br>
The MSDN documentation is quiet on the issue of mode conflict
between fd and a call to fdopen, where posix explicitly will return
an error<br>
<a href="http://linux.die.net/man/3/fdopen" target="_blank">http://linux.die.net/man/3/fdopen</a> "The mode of the stream (one of
the values "r", "r+", "w", "w+", "a", "a+") must be compatible with
the mode of the file descriptor." I could find any google results
for complaints about win32's reckless behaviour.<br>
<br>
Two courses of action are possible:<br>
- fix the test to reflect current cpython and pypy behaviour on
win32<br>
- file a bug with cpython and fix our win32 implementation to pass
the current test<br>
<br>
Any thoughts?<span class="HOEnZb"><font color="#888888"><br>
Matti<br>
</font></span></div>
<br>_______________________________________________<br>
pypy-dev mailing list<br>
<a href="mailto:pypy-dev@python.org">pypy-dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/pypy-dev" target="_blank">https://mail.python.org/mailman/listinfo/pypy-dev</a><br>
<br></blockquote></div><br></div>