New submission from STINNER Victor: Attached patch modifies the binascii module to use the new _PyBytesWriter API.
IMHO the patch makes the code more readable. The code may be faster because it avoids a call to _PyBytes_Resize() in some cases. The change on binascii_rledecode_hqx_impl() should be carefully reviewed, the code is a little bit more complex. It uses a counter to decide when to enlarge the buffer. It calls _PyBytesWriter_Prepare() to enlarge the buffer which uses overallocation. It disables overallocation if we are going to write the last byte. ---------- files: binascii_writer.patch keywords: patch messages: 252852 nosy: haypo priority: normal severity: normal status: open title: Use _PyBytesWriter in the binascii module versions: Python 3.6 Added file: http://bugs.python.org/file40756/binascii_writer.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25384> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com