Windson Yang <wiwind...@outlook.com> added the comment:

I'm not sure it's a bug. When you write binary data to file (use BufferedIOBase 
by default). It actually writes the data to a buffer. That is why tell() gets 
out of sync. You can follow the instrument belolw. For instance, call flush() 
after writing to get the `correct answer.`

> When writing to this object, data is normally placed into an internal buffer. 
> The buffer will be written out to the underlying RawIOBase object under 
> various conditions, including:

> when the buffer gets too small for all pending data;
> when flush() is called;
> when a seek() is requested (for BufferedRandom objects);
> when the BufferedWriter object is closed or destroyed.

1. https://docs.python.org/3/library/io.html#io.BufferedWriter

----------

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

Reply via email to