New submission from Joe Jevnik: Adds a keyword only flag to zlib.decompress and zlib.Decompress.decompress which marks that the return type should be a bytearray instead of bytes.
The use case for this is reading compressed data into a mutable array to do further operations without requiring that the user copy the data first. Often, if a user is choosing to compress the data there might be a real cost to copying the uncompressed bytes into a mutable buffer. The impetus for this change comes from a patch for Pandas (https://github.com/pydata/pandas/pull/12359). I have also worked on a similar feature for blosc, another popular compression library for python (https://github.com/Blosc/python-blosc/pull/107). My hope is to fix the hacky solution presented in the pandas patch by supporting this feature directly in the compression libraries. As a side note: this is my first time using the argument clinic and I love it. It was so simple to add this argument, thank you very much for developing such an amazing tool! ---------- components: Extension Modules files: zlib.patch keywords: patch messages: 260424 nosy: llllllllll priority: normal severity: normal status: open title: zlib decompress as_bytearray flag type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file41944/zlib.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26379> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com