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
Cleanup io.FileIO #67940
Comments
While reviewing a Python implementation of io.FileIO (_pyio.FileIO) in the issue bpo-21859, many issues were found in the C implementation. I open an issue to fix them. We may fix them before or after the Python implementation is merged. |
fileio_drop_dup_fstat.patch: Remove the duplicate call to fstat() in fileio.c. Tests pass, invalid FD are still detected since there is a second call to fstat() which also raises OSError(EBADF) if fstat(fd) fails. |
The previous change related to fstat() is the changeset 3b5279b5bfd1 from the issue bpo-21679. The changeset introduces the private _blksize attribute. The strange thing is that the changelog is: fstat() was called twice and it is still called twice. Maybe I missed something. |
See also issue bpo-21861: "io class name are hardcoded in reprs". In my review of _pyio.FileIO, I asked if it would be possible to use __qualname__ in __getstate__(). |
New changeset bc2a22eaa0af by Victor Stinner in branch 'default': |
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. ====================================================================== 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 |
New changeset 128f92ae8bae by Victor Stinner in branch 'default': |
The changeset 128f92ae8bae also changed _Py_fstat() to release the GIL when calling fstat(), I forgot to mention it in the changeset. test_socket now hangs on AMD64 Snow Leop 3.x, I don't know yet if it's related: http://buildbot.python.org/all/builders/AMD64%20Snow%20Leop%203.x/builds/2870/steps/test/logs/stdio [393/393] test_socket Thread 0x00007fff71296cc0 (most recent call first): |
Oh, there was another hang before, so it's probably not related: http://buildbot.python.org/all/builders/AMD64%20Snow%20Leop%203.x/builds/2852/steps/test/logs/stdio [393/393] test_ssl Thread 0x00007fff71296cc0 (most recent call first): |
Buildbot issues were unrelated and have been fixed. I close the issue. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: