← 输入框|bugs.python.org|刷新

➜

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.

作者 martin.panter
收信人 doerwalter, ezio.melotti, lemburg, martin.panter, serhiy.storchaka, vstinner
日期 2016-08-19.09:06:30
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1471597590.95.0.83137953279.issue23231@psf.upfronthosting.co.za>
In-reply-to
内容
Serhiy’s two proposals won’t work for codecs that include non-zero output for zero input:

>>> tuple(iterencode((), "utf-8-sig"))
(b'\xef\xbb\xbf',)
>>> encode(b"", "uu")
b'begin 666 <data>\n \nend\n'
>>> encode(b"", "zlib")
b'x\x9c\x03\x00\x00\x00\x00\x01'

However I agree that changing the incremental codec APIs is not ideal. Since nobody seems to care that much, it might be simpler to document that:

* iterencode() only works where text str objects can be encoded, so base64-codec is not supported, but rot13-codec is supported
* iterdecode() only works where bytes objects can be decoded, so rot13-codec is not supported, but base64-codec should be supported (pending other aspects of Issue 20132)
历史
日期 用户 动作 参数
2016-08-19 09:06:31martin.panter修改recipients: + martin.panter, lemburg, doerwalter, vstinner, ezio.melotti, serhiy.storchaka
2016-08-19 09:06:30martin.panter修改messageid: <1471597590.95.0.83137953279.issue23231@psf.upfronthosting.co.za>
2016-08-19 09:06:30martin.panter链接issue23231 messages
2016-08-19 09:06:30martin.panter创建