This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: New File I/O type for Python 3000, plus .h and unit tests
Type: Stage:
Components: Interpreter Core Versions: Python 3.0
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: agthorr, collinwinter, gvanrossum
Priority: normal Keywords: patch

Created on 2007-02-28 23:08 by agthorr, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fileio.tar.gz agthorr, 2007-02-28 23:08 File I/O C implementation and unit tests.
pyfileio_type.diff agthorr, 2007-03-08 21:28 patch to add a missing forward declaration
Messages (5)
msg52020 - (view) Author: Daniel Stutzbach (agthorr) Date: 2007-02-28 23:08
Here is my implementation of a raw File I/O type for Python 3000, along with unit tests.  The tests for repr() fail because I'm not 100% sure what repr() should return (in particular, whether the type should bother remembering the filename just to return in repr()).

There are comments at the top of the .c file explaining what remains to be done.
msg52021 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-03-08 00:46
Committed revision 54214.

I tweaked a few things; for example O_APPEND doesn't have the semantics we want (it appends on *every write*).

I turned it into a module and renamed it to _fileio, the class to _FileIO.

The io.py module now imports this and uses it as a base class for *its* FileIO class, if the import works.

There are plenty of XXX things.  I'll try to get large file support working next; as long as off_t is a 64-bit int this should just work.
msg52022 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-08 20:27
Reopening.

I'm seeing build warnings and test failures related to the FileIO work when Python is configured with --with-pydebug. When compiling Modules/_fileio.c, gcc complains about "PyFileIO_Type undeclared"; because the _fileio module fails to build, both test_io and test_fileio fail.

This occurs even after "make distclean". I have r54216 of p3yk, gcc 3.4.6. _fileio.c compiles successfully if Python is configured without --with-pydebug.
msg52023 - (view) Author: Daniel Stutzbach (agthorr) Date: 2007-03-08 21:28
It's missing a forward declaration of PyFileIO_Type near the top of the file so the PyFileIO_Check() macro works.  Currently PyCheck_FileIO is only called inside of an assert() macro, which is why this problem only surfaces in a debug build.  Patch to add the forward declaration attached.
File Added: pyfileio_type.diff
msg52024 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-08 21:47
Checked in as r54226. Reclosing.

Thanks, Daniel!
History
Date User Action Args
2022-04-11 14:56:22adminsetgithub: 44639
2008-01-06 22:29:46adminsetkeywords: - py3k
versions: + Python 3.0
2007-02-28 23:08:39agthorrcreate