Message330368
This is the same as Issue 26158. Truncating text files is not clearly documented for a start, and truncating after reading doesn’t seem to be considered much in the implementations.
Your question is answered at <https://bugs.python.org/issue26158#msg258619>. Your code calls the C implementation of “io.TextIOWrapper.truncate”. This implementation does not consider that there are 8 unread bytes in a buffer, so it truncates the file at the end of the buffer (5 read + 8 unread = 13 bytes). |
|
Date |
User |
Action |
Args |
2018-11-24 01:11:07 | martin.panter | set | recipients:
+ martin.panter, liugang93 |
2018-11-24 01:11:07 | martin.panter | set | messageid: <1543021867.06.0.788709270274.issue35304@psf.upfronthosting.co.za> |
2018-11-24 01:11:06 | martin.panter | link | issue35304 messages |
2018-11-24 01:11:05 | martin.panter | create | |
|