[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 5330af45f777 by Antoine Pitrou in branch '3.2': Issue #12213: Fix a buffering bug with interleaved reads and writes that http://hg.python.org/cpython/rev/5330af45f777 New changeset d7f6391954cf by Antoine Pitrou in branch 'default': Issue #12213: Fix a buffering bug with interleaved reads and writes that http://hg.python.org/cpython/rev/d7f6391954cf -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
STINNER Victor victor.stin...@haypocalc.com added the comment: You should not use BufferedRWPair with the same underlying stream (that's the whole point of BufferedRWPair). It might be documented. Something like Warning: don't use the same stream as reader and writer, or the BufferedRWPair becomes inconsistent on interlaced read-write ? -- status: pending - open title: BufferedRandom: issues with interlaced read-write - BufferedRandom, BufferedRWPair: issues with interlaced read-write ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset cf2010e9f941 by Antoine Pitrou in branch '2.7': Issue #12213: Fix a buffering bug with interleaved reads and writes that http://hg.python.org/cpython/rev/cf2010e9f941 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- title: BufferedRandom, BufferedRWPair: issues with interlaced read-write - BufferedRandom, BufferedRWPair: issues with interlaced read-write ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
Antoine Pitrou pit...@free.fr added the comment: I think your expectations for BufferedRWPair are wrong. You should not use BufferedRWPair with the same underlying stream (that's the whole point of BufferedRWPair). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
Antoine Pitrou pit...@free.fr added the comment: Here is a patch. -- stage: - patch review Added file: http://bugs.python.org/file22950/bufrandom.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
Changes by Antoine Pitrou pit...@free.fr: -- priority: normal - critical type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
STINNER Victor victor.stin...@haypocalc.com added the comment: My patch tries to fix interlaced read-write by always calling flush(), Why do you need to call flush()? Can't you read from the buffer? Hum, my patch does not always call flush of the reader and the writer. On read, it flushs the writer. On write, it flushes the reader (undo readahead). It is maybe possible to do better (do something faster), but there should be some tricky cases with seek(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
Changes by Santoso Wijaya santoso.wij...@gmail.com: -- nosy: +santa4nt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
Antoine Pitrou pit...@free.fr added the comment: My patch tries to fix interlaced read-write by always calling flush(), Why do you need to call flush()? Can't you read from the buffer? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
Changes by STINNER Victor victor.stin...@haypocalc.com: -- title: BufferedRandom: write(); read() gives different result using io and _pyio - BufferedRandom, BufferedRWPair: issues with interlaced read-write ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
STINNER Victor victor.stin...@haypocalc.com added the comment: io_interlaced_read_write.patch: - add interlaced read/write tests for BufferedRandom and BufferedRWPair - _pyio: move undo readahead code into BufferedReader.flush() - io: BufferedRandom.flush() doesn't undo readahead if the write buffer is empty, so it's possible to call it in read methods without flusing the readahead buffer when it's not needed - read(), read1(), readinto(), peek() calls writer.flush() - write() calls reader.flush() (undo readahead) TODO: - tests BufferedRWPair with read-only + write-only files because I'm not sure if my tests using readable and writeable methods - _pyio: undo the readahead in BufferedReader.flush() is no perfect, because BufferedReader is supposed to be read-only. I choosed that to factorize the code between BufferedRandom and BufferedRWPair - what happens if a write occurs during _pyio.BufferedReader.flush()? if self._read_buf: write occurs with self._read_lock: We may protect the read of self._read_buf with the read lock. My patch tries to fix interlaced read-write by always calling flush(), but I am not sure that it doesn't change read-only and write-only cases. There are maybe some unnecessary call to flush(). -- keywords: +patch Added file: http://bugs.python.org/file22190/io_interlaced_read_write.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
STINNER Victor victor.stin...@haypocalc.com added the comment: See also issue #12215: TextIOWrapper has also issues on interlaced read-write. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12213] BufferedRandom, BufferedRWPair: issues with interlaced read-write
Changes by STINNER Victor victor.stin...@haypocalc.com: -- versions: +Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12213 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com