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
Add Python implementation of FileIO #66058
Comments
Proposed patch adds Python implementation of FileIO in _pyio. This will help to make io and _pyio dependency on _io optional (bpo-17984). |
Many thanks Victor for your review. Updated patch addresses your comments. It also fixes debugging remnants in test_file_eintr. |
Next iteration of the patch addressed Victor's comments. |
Next iteration of the patch addressed Victor's and Akira's comments. |
Synchronized with the tip. _io.FileIO now behave same as _pyio,FileIO when there is a NUL in name. |
Updated to the tip (added the closefd attribute in repr). os.fstat() is now called only once in the constructor. |
Restored first os.fstat() (however it now is redundant) and addressed most other Victor's comments. In general I prefer EAFP over BDFL, and often "except AttributeError" looks better to me than getattr(). |
I opened the issue bpo-23752: "Cleanup io.FileIO". |
New issue bpo-23754: "Add a new os.read_into() function to avoid memory copies". |
What's the status of the patch? Is it ready to be commited? |
Removed redundant fstat() call (as in bpo-23752). Slightly corrected docstrings (but for larger changes C and Python implementations should be changed consistently). I wait only for your approval Victor. |
I reviewed pyio_fileio_9.patch. The main issue is that I don't understand how self._fd is set to None. In the C implemented, it's set to -1 even if closefd is False. For comments on docstrings which also concern the C code, can you maybe open a new issue with a reference to this issue or maybe even a link to my review, if you don't want to modify them in this issue? |
Updated patch addresses Victor's and Berker's comments. |
pyio_fileio_10.patch looks good to me. Great job. |
Thank you for your review Victor and others. |
New changeset 0db36098b908 by Serhiy Storchaka in branch '2.7': New changeset d080f5ecdcd3 by Serhiy Storchaka in branch '3.4': New changeset 330910697e23 by Serhiy Storchaka in branch 'default': New changeset 9ef5765d56b7 by Serhiy Storchaka in branch 'default': |
There are test failures on Windows: http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/6073/steps/test/logs/stdio
Here is a patch that adds explicit check for null character and skips tests with not implemented truncate. |
Steve Dower wrote a patch and the latest version looks good to me: + if 0 in os.fsencode(file): IMO the check must be implemented in os.open() (in path_converter). It doesn't look right to have a differen behaviour on UNIX and Windows. path_converter() calls PyUnicode_FSConverter() on UNIX and this function checks for embedded null bytes. So I would prefer to see the issue bpo-23668 fixed and path_converter() fixed, instead of pushing pyio_fileio_fix.patch. |
Opened bpo-23908 for null characters in paths. |
Both issues are fixed. |
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: