Message137259
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(). |
|
Date |
User |
Action |
Args |
2011-05-30 11:57:31 | vstinner | set | recipients:
+ vstinner, jcea, pitrou |
2011-05-30 11:57:31 | vstinner | set | messageid: <1306756651.54.0.607962084751.issue12213@psf.upfronthosting.co.za> |
2011-05-30 11:57:30 | vstinner | link | issue12213 messages |
2011-05-30 11:57:30 | vstinner | create | |
|