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.

Author pakal
Recipients pakal
Date 2009-09-18.13:21:51
SpamBayes Score 1.110223e-13
Marked as misclassified No
Message-id <1253280113.21.0.651669029601.issue6939@psf.upfronthosting.co.za>
In-reply-to
Content
Hello

I'm having trouble around the behaviour of the io module's truncate
methods, in py3k. If I remember well, under unix and older versions of
Python (with other file types), truncate never move the fiel pointer
(and had to fake that behaviour under windows as well, by
saving/restoring the file pointer).

However, I see nothing in the documentation of the io module about that,
and studying the _fileio.c code, it seems that now the file pointer is
(under all OS) moved to the truncation point, and left there.

Maybe it requires discusions on the mailing list, but personally I think
that the common unix behaviour (letting the file pointer untouched)
would be better for everyone, and that the doc should claim it.

Also, additional notes about the behaviour of that truncation (reminding
people that on some OS, the padding is zero-filled, on others it's
not...) would be great.

Current doc of io in py3k :
http://docs.python.org/py3k/library/io.html#io.IOBase.truncate
truncate(size=None)
    Truncate the file to at most size bytes. size defaults to the
current file position, as returned by tell().

Cheers
Pascal
History
Date User Action Args
2009-09-18 13:21:53pakalsetrecipients: + pakal
2009-09-18 13:21:53pakalsetmessageid: <1253280113.21.0.651669029601.issue6939@psf.upfronthosting.co.za>
2009-09-18 13:21:52pakallinkissue6939 messages
2009-09-18 13:21:51pakalcreate