Serhiy Storchaka added the comment:
This is expected behavior. When you write to ByitesIO you overwrites the old
content.
If you want to append to ByitesIO, first move the position to the end:
b.seek(0, io.SEEK_END).
--
nosy: +serhiy.storchaka
resolution: -> not a bug
stage: -> reso
New submission from Samuli G:
The initial bytes provided for the BytesIO constructor are lost when the stream
is written to.
Seeking to offset zero, and then getting the value of the entire buffer results
of getting only the bytes that have been appended by calling "write".
--
compone