Repository navigation
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytopic-IOtype-featureA feature request or enhancement
Description
| BPO | 21859 |
|---|---|
| Nosy | @pitrou, @vstinner, @benjaminp, @alex, @vadmium, @serhiy-storchaka |
| Dependencies | |
| Files |
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:
assignee = 'https://github.com/serhiy-storchaka'
closed_at = <Date 2015-05-12.11:06:09.075>
created_at = <Date 2014-06-24.11:06:53.860>
labels = ['type-feature', 'library', 'expert-IO']
title = 'Add Python implementation of FileIO'
updated_at = <Date 2015-05-12.11:06:09.073>
user = 'https://github.com/serhiy-storchaka'bugs.python.org fields:
activity = <Date 2015-05-12.11:06:09.073>
actor = 'serhiy.storchaka'
assignee = 'serhiy.storchaka'
closed = True
closed_date = <Date 2015-05-12.11:06:09.075>
closer = 'serhiy.storchaka'
components = ['Library (Lib)', 'IO']
creation = <Date 2014-06-24.11:06:53.860>
creator = 'serhiy.storchaka'
dependencies = ['23668']
files = ['35769', '35858', '35871', '36032', '36183', '36782', '38651', '38653', '38885', '38888', '38889']
hgrepos = []
issue_num = 21859
keywords = ['patch']
message_count = 21.0
messages = ['221449', '222303', '222375', '223659', '224446', '228240', '239004', '239012', '239046', '239071', '240390', '240402', '240412', '240415', '240416', '240420', '240421', '240429', '240430', '240437', '242961']
nosy_count = 9.0
nosy_names = ['pitrou', 'vstinner', 'benjamin.peterson', 'stutzbach', 'alex', 'python-dev', 'martin.panter', 'piotr.dobrogost', 'serhiy.storchaka']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue21859'
versions = ['Python 3.5']Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directorytopic-IOtype-featureA feature request or enhancement
Activity
serhiy-storchaka commentedon Jun 24, 2014
Proposed patch adds Python implementation of FileIO in _pyio. This will help to make io and _pyio dependency on _io optional (bpo-17984).
serhiy-storchaka commentedon Jul 4, 2014
Updated patch has included recent changes from C implementation (bpo-21679 and bpo-21090).
serhiy-storchaka commentedon Jul 5, 2014
Many thanks Victor for your review. Updated patch addresses your comments. It also fixes debugging remnants in test_file_eintr.
serhiy-storchaka commentedon Jul 22, 2014
Next iteration of the patch addressed Victor's comments.
serhiy-storchaka commentedon Jul 31, 2014
Next iteration of the patch addressed Victor's and Akira's comments.
serhiy-storchaka commentedon Oct 2, 2014
Synchronized with the tip. _io.FileIO now behave same as _pyio,FileIO when there is a NUL in name.
serhiy-storchaka commentedon Mar 23, 2015
Updated to the tip (added the closefd attribute in repr). os.fstat() is now called only once in the constructor.
serhiy-storchaka commentedon Mar 23, 2015
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().
vstinner commentedon Mar 23, 2015
I opened the issue bpo-23752: "Cleanup io.FileIO".
vstinner commentedon Mar 23, 2015
New issue bpo-23754: "Add a new os.read_into() function to avoid memory copies".
vstinner commentedon Apr 9, 2015
What's the status of the patch? Is it ready to be commited?
serhiy-storchaka commentedon Apr 9, 2015
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.
vstinner commentedon Apr 10, 2015
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?
serhiy-storchaka commentedon Apr 10, 2015
Updated patch addresses Victor's and Berker's comments.
vstinner commentedon Apr 10, 2015
pyio_fileio_10.patch looks good to me. Great job.
serhiy-storchaka commentedon Apr 10, 2015
Thank you for your review Victor and others.
python-dev commentedon Apr 10, 2015
New changeset 0db36098b908 by Serhiy Storchaka in branch '2.7':
Issue bpo-21859: Corrected FileIO docstrings.
https://hg.python.org/cpython/rev/0db36098b908
New changeset d080f5ecdcd3 by Serhiy Storchaka in branch '3.4':
Issue bpo-21859: Corrected FileIO docstrings.
https://hg.python.org/cpython/rev/d080f5ecdcd3
New changeset 330910697e23 by Serhiy Storchaka in branch 'default':
Issue bpo-21859: Corrected FileIO docstrings.
https://hg.python.org/cpython/rev/330910697e23
New changeset 9ef5765d56b7 by Serhiy Storchaka in branch 'default':
Issue bpo-21859: Added Python implementation of io.FileIO.
https://hg.python.org/cpython/rev/9ef5765d56b7
serhiy-storchaka commentedon Apr 10, 2015
There are test failures on Windows: http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/6073/steps/test/logs/stdio
ValueError is not raised if file name contains a null character.
os.ftruncate doesn't exist on Windows.
Here is a patch that adds explicit check for null character and skips tests with not implemented truncate.
vstinner commentedon Apr 10, 2015
Steve Dower wrote a patch and the latest version looks good to me:
https://bugs.python.org/issue23668#msg240385
+ if 0 in os.fsencode(file):
+ raise ValueError('embedded null character')
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.
serhiy-storchaka commentedon Apr 10, 2015
Opened bpo-23908 for null characters in paths.
serhiy-storchaka commentedon May 12, 2015
Both issues are fixed.