[issue38482] BUG in codecs.BufferedIncrementalDecoder

2019-10-17 Thread Walter Dörwald
Walter Dörwald added the comment: codecs.iterencode()/iterdecode() are just shallow 10-line wrappers around incremental codecs (which are used as the basis of io streams). Note that the doc string for iterencode() contains: Encodes the input strings from the iterator using an IncrementalEn

[issue38482] BUG in codecs.BufferedIncrementalDecoder

2019-10-15 Thread Jim Carroll
Jim Carroll added the comment: I understand. btw; I did a deep dive on cpython codebase, and the only references to codecs.iterencode()/iterdecode() is in ./Lib/tests/test_codecs.py. I suspect functions are not used by many people. The patch I proposed was a three line change that would all

[issue38482] BUG in codecs.BufferedIncrementalDecoder

2019-10-15 Thread Walter Dörwald
Walter Dörwald added the comment: The documentation might be unclear here. But the argument iterator of iterdecode(iterator, encoding, errors='strict', **kwargs) *is* supposed to be an iterable over bytes objects. In fact iterencode() transforms an iterator over strings into an iterator ov

[issue38482] BUG in codecs.BufferedIncrementalDecoder

2019-10-15 Thread Jim Carroll
Jim Carroll added the comment: According to the documentation (https://docs.python.org/3.7/library/codecs.html#codecs.iterdecode), the first parameter is a bytes object to decode (not an iterable of bytes). Which is also consistent with it's companion iterencode() which accepts a str object,

[issue38482] BUG in codecs.BufferedIncrementalDecoder

2019-10-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The first argument of iterdecode() should be an iterable of bytes objects, not a bytes object. Try codecs.iterdecode([enc], 'utf-8') -- nosy: +serhiy.storchaka ___ Python tracker

[issue38482] BUG in codecs.BufferedIncrementalDecoder

2019-10-15 Thread Jim Carroll
Change by Jim Carroll : Added file: https://bugs.python.org/file48662/codecs.patch ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue38482] BUG in codecs.BufferedIncrementalDecoder

2019-10-15 Thread Jim Carroll
Change by Jim Carroll : Removed file: https://bugs.python.org/file48661/codecs.patch ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue38482] BUG in codecs.BufferedIncrementalDecoder

2019-10-15 Thread Jim Carroll
New submission from Jim Carroll : While working with codecs.iterdecode(), encountered "can't concat int to bytes". The source of the problem is BufferedIncrementalDecoder stores it's internal buffer as a bytes (ie: b""), but decode() can be passed either a byte string or in the case of iterde