jd-boyd / python-lzo

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

Make py_ssize_t_clean. #46

Closed jd-boyd closed 3 years ago

jd-boyd commented 5 years ago

Hmm, seems that these changes aren't compatible with Windows yet. Grr.

Rosuav commented 3 years ago

I believe this may be the problem with Python 3.10 support.

Python 3.9:

>>> import lzo
>>> lzo.compress(b"Hello, world", 1, False)
<stdin>:1: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
b'\x1dHello, world\x11\x00\x00'
>>> lzo.decompress(b'\x1dHello, world\x11\x00\x00', False, 12)
b'Hello, world'

Python 3.10:

>>> lzo.decompress(b'\x1dHello, world\x11\x00\x00', False, 12)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
lzo.error: Header error - invalid compressed data
>>> lzo.compress(b"Hello, world", 1, False)
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: <built-in function compress> returned a result with an error set

For now, I'm using Python 3.9 for the project that needs this.

Rosuav commented 3 years ago

And while I'd love to be able to offer to help with this PR, unfortunately I don't do Windows dev, so anything I can help with is probably what you're already able to do.

Rosuav commented 3 years ago

Is the problem here that the latest test works only on 64-bit systems? Or rather, that decompressing >2GB of data works only on 64-bit systems? That seems like a reasonable limitation to me.