This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nadeem.vawda
Recipients dabeaz, nadeem.vawda, pitrou
Date 2012-08-03.22:27:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1344032860.6.0.461945849168.issue15546@psf.upfronthosting.co.za>
In-reply-to
Content
The cause of this problem is that BZ2File.read1() sometimes returns b"", even though
the file is not at EOF. This happens when the underlying BZ2Decompressor cannot produce
any decompressed data from just the block passed to it in _fill_buffer(); in this case, it needs to read more of the compressed stream to make progress.

It would seem that BZ2File cannot satisfy the contract of the read1() method - we
can't guarantee that a single call to the read() method of the underlying file will
allow us to return a non-empty result, whereas returning b"" is reserved for the
case where we have reached EOF.

Simply removing the read1() method would simply trade this problem for a bigger one
(resurrecting issue 10791), so I propose amending BZ2File.read1() to make as many reads
from the underlying file as necessary to return a non-empty result.

Antoine, what do you think of this?
History
Date User Action Args
2012-08-03 22:27:40nadeem.vawdasetrecipients: + nadeem.vawda, pitrou, dabeaz
2012-08-03 22:27:40nadeem.vawdasetmessageid: <1344032860.6.0.461945849168.issue15546@psf.upfronthosting.co.za>
2012-08-03 22:27:40nadeem.vawdalinkissue15546 messages
2012-08-03 22:27:39nadeem.vawdacreate