Марк Коренберг added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25849>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to