jd-boyd / python-lzo

Python bindings for the LZO data compression library
GNU General Public License v2.0
74 stars 41 forks source link

Support Python Memory Views #41

Open lehanesa opened 5 years ago

lehanesa commented 5 years ago

Python 3.8 introduces a new shared memory module for multiprocessing. The buffer is available as a python memory view.

Rather than copying the data to a new byte like object for decompression it would be great if we can pass the memory view directly. This would greatly improve the decompression when working with memory views. Currently it produces the error:

"argument 1 must be read-only bytes-like object, not memoryview"

jd-boyd commented 5 years ago

I would love to see a pull request to support this. However, at the moment it would also need to continue to support python 2.6, 2.7 and the 3.x back to 3.3.

keelung-yang commented 4 years ago

I got

TypeError: argument 1 must be read-only bytes-like object, not bytearray

I use bytearray because I've to serialize some data structure at runtime.

Some packages have dropped python 2.7 support in new release. Ubuntu 20.04 have removed python2. And some linux distribution have linked python command to /usr/bin/python3. It's time to say goodbye to python2.