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 amaury.forgeotdarc
Recipients amaury.forgeotdarc
Date 2007-10-24.22:30:31
SpamBayes Score 0.0002044573
Marked as misclassified No
Message-id <1193265033.18.0.927714620141.issue1323@psf.upfronthosting.co.za>
In-reply-to
Content
This patch corrects a problem in test_file.py on Windows:
f.truncate() seeks to the truncation point, but does not empty the
buffers. In the test, f.tell() returns -1...

Now we flush the file before, and seek to the initial position after.
The same trick was present in 2.5, in fileobject.c::file_truncate. The
same comments apply as well.

Reviewers needed! Flushing may change the behaviour, but seems more
correct to me (and closer to python2.5). Should we add specific tests
for this?

Also, change the test to be sure to close the file before trying to
remove it (it seems that in a finally: block, the exception still
references all the local variables in the traceback). Otherwise the
previous problem is hidden by a "file locked" error in the finally block.
Files
File name Uploaded
truncate.diff amaury.forgeotdarc, 2007-10-24.22:30:31
History
Date User Action Args
2007-10-24 22:30:33amaury.forgeotdarcsetspambayes_score: 0.000204457 -> 0.0002044573
recipients: + amaury.forgeotdarc
2007-10-24 22:30:33amaury.forgeotdarcsetspambayes_score: 0.000204457 -> 0.000204457
messageid: <1193265033.18.0.927714620141.issue1323@psf.upfronthosting.co.za>
2007-10-24 22:30:33amaury.forgeotdarclinkissue1323 messages
2007-10-24 22:30:31amaury.forgeotdarccreate