[New-bugs-announce] [issue25384] Use _PyBytesWriter in the binascii module

STINNER Victor report at bugs.python.org
Mon Oct 12 13:40:15 CEST 2015


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 <report at bugs.python.org>
<http://bugs.python.org/issue25384>
_______________________________________


More information about the New-bugs-announce mailing list