Serhiy Storchaka added the comment: The patch changes public interface. This breaks compatibility with third-party codecs implementing it.
We have found other solution to iterencode/iterdecode problem. For example we can buffer iterated values and encode with one step delay: prev = sentinel = object() for input in iterator: if prev is not sentinel: output = encoder.encode(prev) if output: yield output prev = input if prev is not sentinel: output = encoder.encode(prev, True) if output: yield output Or remember the previous value and use it to calculate the empty value at the end (works only if input type supports slicing): prev = sentinel = object() for input in iterator: output = encoder.encode(input) if output: yield output prev = input if prev is not sentinel: output = encoder.encode(prev[:0], True) if output: yield output ---------- nosy: +doerwalter, lemburg versions: +Python 3.6 -Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23231> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com