[issue15644] after _bytesio.seek(0), _bytesio.getvalue() returned reversed data.
Ned Deily added the comment: The program works as expected. After the first two writes, the buffer contains b'abcdef'. Then the seek(0) moves the stream pointer to the beginning of the buffer and the next write overwrites buffer positions 0 through 2, replacing b'abc' with b'xyz'. So now the buffer is b'xyzdef'. The next read starts at position 3 (following the last byte written), reading b'de'. -- nosy: +ned.deily resolution: - works for me stage: - committed/rejected status: open - closed type: behavior - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15644 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15644] after _bytesio.seek(0), _bytesio.getvalue() returned reversed data.
umedoblock added the comment: thanks Ned. I understood your comment. I'm happy! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15644 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15644] after _bytesio.seek(0), _bytesio.getvalue() returned reversed data.
New submission from umedoblock: import io _bytesio = io.BytesIO() _bytesio.write(b'abc') _bytesio.write(b'def') _bytesio.seek(0) _bytesio.write(b'xyz') print(_bytesio.read(2)) print(_bytesio.read(2)) print(_bytesio.getvalue()) # output b'de' b'f' b'xyzdef' # where is the b'abc' ? -- components: IO messages: 168174 nosy: umedoblock priority: normal severity: normal status: open title: after _bytesio.seek(0), _bytesio.getvalue() returned reversed data. type: behavior versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15644 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com