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.

作者 serhiy.storchaka
收信人 amaury.forgeotdarc, nadeem.vawda, serhiy.storchaka
日期 2012-10-29.16:50:50
SpamBayes Score -1.0
Marked as misclassified
Message-id <1351529450.55.0.478247493767.issue16350@psf.upfronthosting.co.za>
In-reply-to
内容
There is yet one memory management bug (with unconsumed_tail).

flush() does not update unconsumed_tail and unused_data.

>>> import zlib
>>> x = zlib.compress(b'abcdefghijklmnopqrstuvwxyz') + b'0123456789'
>>> dco = zlib.decompressobj()
>>> dco.decompress(x, 1)
b'a'
>>> dco.flush()
b'bcdefghijklmnopqrstuvwxyz'
>>> dco.unconsumed_tail
b'NIMK\xcf\xc8\xcc\xca\xce\xc9\xcd\xcb/(,*.)-+\xaf\xa8\xac\x02\x00\x90\x86\x0b 0123456789'
>>> dco.unused_data
b''

What should unconsumed_tail be equal after EOF? b'' or unused_data?

>>> import zlib
>>> x = zlib.compress(b'abcdefghijklmnopqrstuvwxyz') + b'0123456789'
>>> dco = zlib.decompressobj()
>>> dco.decompress(x)
b'abcdefghijklmnopqrstuvwxyz'
>>> dco.flush()
b''
>>> dco.unconsumed_tail
b''
>>> dco.unused_data
b'0123456789'
>>> dco = zlib.decompressobj()
>>> dco.decompress(x, 1000)
b'abcdefghijklmnopqrstuvwxyz'
>>> dco.flush()
b''
>>> dco.unconsumed_tail
b'0123456789'
>>> dco.unused_data
b'0123456789'
历史
日期 用户 动作 参数
2012-10-29 16:50:50serhiy.storchaka修改recipients: + serhiy.storchaka, amaury.forgeotdarc, nadeem.vawda
2012-10-29 16:50:50serhiy.storchaka修改messageid: <1351529450.55.0.478247493767.issue16350@psf.upfronthosting.co.za>
2012-10-29 16:50:50serhiy.storchaka链接issue16350 messages
2012-10-29 16:50:50serhiy.storchaka创建