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 vajrasky
Recipients nadeem.vawda, vajrasky
Date 2014-03-06.08:56:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1394096199.33.0.0844376758582.issue20856@psf.upfronthosting.co.za>
In-reply-to
Content
# Bug demo
TEXT_LINES = [
    b'cutecat\n',
    b'promiscuousbonobo\n',
]
TEXT = b''.join(TEXT_LINES)
import bz2
filename = '/tmp/demo.bz2'
with open(filename, 'wb') as f:
    f.write(bz2.compress(TEXT))

with bz2.BZ2File(filename) as bz2f:
    pdata = bz2f.peek(n=7)
    print(pdata)

It outputs b'cutecat\npromiscuousbonobo\n', not b'cutecat'.

Here is the patch to fix the bug.
History
Date User Action Args
2014-03-06 08:56:39vajraskysetrecipients: + vajrasky, nadeem.vawda
2014-03-06 08:56:39vajraskysetmessageid: <1394096199.33.0.0844376758582.issue20856@psf.upfronthosting.co.za>
2014-03-06 08:56:38vajraskylinkissue20856 messages
2014-03-06 08:56:38vajraskycreate