➜

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.

作者 amaury.forgeotdarc
收信人 amaury.forgeotdarc
日期 2007-10-24.22:30:31
SpamBayes Score 0.0002044573
Marked as misclassified 否
Message-id <1193265033.18.0.927714620141.issue1323@psf.upfronthosting.co.za>
In-reply-to
内容
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.
文件
文件名 上传时间
truncate.diff amaury.forgeotdarc, 2007-10-24.22:30:31
历史
日期 用户 动作 参数
2007-10-24 22:30:33amaury.forgeotdarc修改spambayes_score: 0.000204457 -> 0.0002044573
recipients: + amaury.forgeotdarc
2007-10-24 22:30:33amaury.forgeotdarc修改spambayes_score: 0.000204457 -> 0.000204457
messageid: <1193265033.18.0.927714620141.issue1323@psf.upfronthosting.co.za>
2007-10-24 22:30:33amaury.forgeotdarc链接issue1323 messages
2007-10-24 22:30:31amaury.forgeotdarc创建