[issue23796] BufferedReader.peek() crashes if closed

John Hergenroeder report at bugs.python.org
Wed Apr 1 19:49:52 CEST 2015


John Hergenroeder added the comment:

Thanks for the feedback, Berker!

I've added a test case that closes a buffered reader and then attempts to both peek and read1 it. I tacked it onto the end of the BufferedReaderTest class in test_io, but let me know if there's a better place to put it.

I've also added the check to read1 -- good catch. I opted to add it before the check that the argument to read1 is 0 -- my assumption is that a 0-length read on a closed BufferReader should fail, not return an empty bytestring.

Thanks again for the feedback!

----------
Added file: http://bugs.python.org/file38787/23796_fix_with_tests.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23796>
_______________________________________


More information about the Python-bugs-list mailing list