Message256559
| Author |
socketpair |
| Recipients |
ezio.melotti, martin.panter, pitrou, r.david.murray, socketpair, vstinner |
| Date |
2015年12月16日.22:59:25 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1450306766.2.0.540948824943.issue25849@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Seems this object should also incapsulate weakref to opened file... (to prevent using it on another text file)
* after writing, all objects, that incapsulate offset > current (during start of write()) should become invalid.
* truncate(arg) should also make that objects invalid for offsets > arg
One bad thing: seeking to the end of file is not safe:
If someone opens logfile, last byte in that text file may belong to middle of multibyte sequence. This really may happen, since Linux (libc) writes files page-by-page (if not line-buffered), so if page boundary is inside character, this bad thing may happen. Real case - is implementing something like `tail -f` in python (to, say, monitor log files).
So, seeking to the end of file is also wrong, and should be disallowed. If so, how to append text to text files ? very upset :( :( I don't know decision of that problem. |
|