STINNER Victor added the comment: Hum, _Py_fstat() is not used correctly in _io.FilIO: it uses errno instead of GetLastError() to raise the OSError. It's too hard to use the new _Py_fstat() function directly, I modified it to raise directly the exception. So the caller doesn't have to use #ifdef MS_WINDOWS to raise the exception correctly.
I added _Py_fstat_noraise() when it's not possible to use an exception. http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/5978/steps/test/logs/stdio ====================================================================== FAIL: test_fdopen (test.test_os.TestInvalidFD) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_os.py", line 1418, in check f(support.make_bad_fd(), *args) File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\os.py", line 1028, in fdopen return io.open(fd, *args, **kwargs) OSError: [Errno 0] Error During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_os.py", line 1411, in helper self.check(getattr(os, f)) File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_os.py", line 1420, in check self.assertEqual(e.errno, errno.EBADF) AssertionError: 0 != 9 ---------- nosy: +holdenweb resolution: fixed -> status: closed -> open _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23752> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com