Skip to content

ZStd test fail on 32bit atchitectures #781

@avalentino

Description

@avalentino

On i386, 5 zstd related tests fail due to

E   SystemError: Negative size passed to PyBytes_FromStringAndSize` 

The relevant part of the test log is below

$ python3 -m pytest -k "not test_non_numpy_inputs and not test_non_numpy_inputs and not test_native_functions" -v --pyargs numcodecs --ignore=./numcodecs/pcodec.py --ignore=./numcodecs/zarr3.py --ignore=./numcodecs/tests/test_zarr3.py
============================= test session starts ==============================
platform linux -- Python 3.13.6, pytest-8.4.1, pluggy-1.6.0 -- /usr/bin/python3.13
cachedir: .pytest_cache
rootdir: /builds/science-team/numcodecs/debian/output/source_dir/.pybuild/cpython3_3.13_numcodecs/build
configfile: pyproject.toml
plugins: cov-5.0.0, typeguard-4.4.2
collecting ... collected 740 items / 27 deselected / 4 skipped / 713 selected

numcodecs/astype.py::numcodecs.astype.AsType PASSED                      [  0%]

[CUT]

numcodecs/tests/test_zstd.py::test_streaming_decompression FAILED        [100%]

=================================== FAILURES ===================================
_____________________ test_pyzstd_streaming[Hello World!] ______________________

input = b'Hello World!'

    @pytest.mark.parametrize("input", test_data)
    def test_pyzstd_streaming(input):
        """
        Test if Zstd can decode a single frame and concatenated frames in streaming
        mode where the decompressed size is not recorded in the frame header.
        """
        pyzstd_c = pyzstd.ZstdCompressor()
        pyzstd_d = pyzstd.ZstdDecompressor()
        pyzstd_e = pyzstd.EndlessZstdDecompressor()
        z = Zstd()
    
        d_bytes = input
        pyzstd_c.compress(d_bytes)
        c_bytes = pyzstd_c.flush()
>       assert z.decode(c_bytes) == d_bytes
               ^^^^^^^^^^^^^^^^^

numcodecs/tests/test_pyzstd.py:66: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
numcodecs/zstd.pyx:388: in numcodecs.zstd.Zstd.decode
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   SystemError: Negative size passed to PyBytes_FromStringAndSize

numcodecs/zstd.pyx:229: SystemError
_ test_pyzstd_streaming[\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00\x00\x05\x00\x00\x00\x06\x00\x00\x00\x07\x00\x00\x00\x08\x00\x00\x00\t\x00\x00\x00\n\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\r\x00\x00\x00\x0e\x00\x00\x00\x0f\x00\x00\x00\x10\x00\x00\x00\x11\x00\x00\x00\x12\x00\x00\x00\x13\x00\x00\x00\x14\x00\x00\x00\x15\x00\x00\x00\x16\x00\x00\x00\x17\x00\x00\x00\x18\x00\x00\x00\x19\x00\x00\x00\x1a\x00\x00\x00\x1b\x00\x00\x00\x1c\x00\x00\x00\x1d\x00\x00\x00\x1e\x00\x00\x00\x1f\x00\x00\x00 \x00\x00\x00!\x00\x00\x00"\x00\x00\x00#\x00\x00\x00$\x00\x00\x00%\x00\x00\x00&\x00\x00\x00'\x00\x00\x00(\x00\x00\x00)\x00\x00\x00*\x00\x00\x00+\x00\x00\x00,\x00\x00\x00-\x00\x00\x00.\x00\x00\x00/\x00\x00\x000\x00\x00\x001\x00\x00\x002\x00\x00\x003\x00\x00\x004\x00\x00\x005\x00\x00\x006\x00\x00\x007\x00\x00\x008\x00\x00\x009\x00\x00\x00:\x00\x00\x00;\x00\x00\x00<\x00\x00\x00=\x00\x00\x00>\x00\x00\x00?\x00\x00\x00@\x00\x00\x00A\x00\x00\x00B\x00\x00\x00C\x00\x00\x00D\x00\x00\x00E\x00\x00\x00F\x00\x00\x00G\x00\x00\x00H\x00\x00\x00I\x00\x00\x00J\x00\x00\x00K\x00\x00\x00L\x00\x00\x00M\x00\x00\x00N\x00\x00\x00O\x00\x00\x00P\x00\x00\x00Q\x00\x00\x00R\x00\x00\x00S\x00\x00\x00T\x00\x00\x00U\x00\x00\x00V\x00\x00\x00W\x00\x00\x00X\x00\x00\x00Y\x00\x00\x00Z\x00\x00\x00[\x00\x00\x00\\x00\x00\x00]\x00\x00\x00^\x00\x00\x00_\x00\x00\x00`\x00\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00d\x00\x00\x00e\x00\x00\x00f\x00\x00\x00g\x00\x00\x00h\x00\x00\x00i\x00\x00\x00j\x00\x00\x00k\x00\x00\x00l\x00\x00\x00m\x00\x00\x00n\x00\x00\x00o\x00\x00\x00p\x00\x00\x00] _

input = b'\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00\x00\x05\x00\x00\x00\x06\x00\x00\x00\x07...0h\x00\x00\x00i\x00\x00\x00j\x00\x00\x00k\x00\x00\x00l\x00\x00\x00m\x00\x00\x00n\x00\x00\x00o\x00\x00\x00p\x00\x00\x00'

    @pytest.mark.parametrize("input", test_data)
    def test_pyzstd_streaming(input):
        """
        Test if Zstd can decode a single frame and concatenated frames in streaming
        mode where the decompressed size is not recorded in the frame header.
        """
        pyzstd_c = pyzstd.ZstdCompressor()
        pyzstd_d = pyzstd.ZstdDecompressor()
        pyzstd_e = pyzstd.EndlessZstdDecompressor()
        z = Zstd()
    
        d_bytes = input
        pyzstd_c.compress(d_bytes)
        c_bytes = pyzstd_c.flush()
>       assert z.decode(c_bytes) == d_bytes
               ^^^^^^^^^^^^^^^^^

numcodecs/tests/test_pyzstd.py:66: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
numcodecs/zstd.pyx:388: in numcodecs.zstd.Zstd.decode
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   SystemError: Negative size passed to PyBytes_FromStringAndSize

numcodecs/zstd.pyx:229: SystemError
_ test_pyzstd_streaming[\n\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\r\x00\x00\x00\x0e\x00\x00\x00] _

input = b'\n\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\r\x00\x00\x00\x0e\x00\x00\x00'

    @pytest.mark.parametrize("input", test_data)
    def test_pyzstd_streaming(input):
        """
        Test if Zstd can decode a single frame and concatenated frames in streaming
        mode where the decompressed size is not recorded in the frame header.
        """
        pyzstd_c = pyzstd.ZstdCompressor()
        pyzstd_d = pyzstd.ZstdDecompressor()
        pyzstd_e = pyzstd.EndlessZstdDecompressor()
        z = Zstd()
    
        d_bytes = input
        pyzstd_c.compress(d_bytes)
        c_bytes = pyzstd_c.flush()
>       assert z.decode(c_bytes) == d_bytes
               ^^^^^^^^^^^^^^^^^

numcodecs/tests/test_pyzstd.py:66: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
numcodecs/zstd.pyx:388: in numcodecs.zstd.Zstd.decode
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   SystemError: Negative size passed to PyBytes_FromStringAndSize

numcodecs/zstd.pyx:229: SystemError
_ test_pyzstd_streaming[+\x00*\x00\x1c\x00'\x00\x1c\x00\x0e\x00\r\x00#\x00*\x00!\x00(\x00\x05\x00\x16\x00$\x00\x11\x00\x13\x00\n\x00(\x00\t\x00\x10\x00\x0c\x00-\x00\x04\x00\x08\x00\x07\x00\x1f\x00\x16\x00\x15\x00\x08\x00\x07\x00\t\x00\x13\x00(\x000\x00\x11\x00\x0e\x00\x1b\x00\x1a\x00\x1b\x00-\x00\x15\x00\x1c\x00&\x00\x0c\x00,\x00\n\x00\x11\x00"\x00\x1b\x00-\x00'\x00\x1b\x00\n\x00] _

input = b'+\x00*\x00\x1c\x00\'\x00\x1c\x00\x0e\x00\r\x00#\x00*\x00!\x00(\x00\x05\x00\x16\x00$\x00\x11\x00\x13\x00\n\x00(\x00\t...x00\x1b\x00\x1a\x00\x1b\x00-\x00\x15\x00\x1c\x00&\x00\x0c\x00,\x00\n\x00\x11\x00"\x00\x1b\x00-\x00\'\x00\x1b\x00\n\x00'

    @pytest.mark.parametrize("input", test_data)
    def test_pyzstd_streaming(input):
        """
        Test if Zstd can decode a single frame and concatenated frames in streaming
        mode where the decompressed size is not recorded in the frame header.
        """
        pyzstd_c = pyzstd.ZstdCompressor()
        pyzstd_d = pyzstd.ZstdDecompressor()
        pyzstd_e = pyzstd.EndlessZstdDecompressor()
        z = Zstd()
    
        d_bytes = input
        pyzstd_c.compress(d_bytes)
        c_bytes = pyzstd_c.flush()
>       assert z.decode(c_bytes) == d_bytes
               ^^^^^^^^^^^^^^^^^

numcodecs/tests/test_pyzstd.py:66: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
numcodecs/zstd.pyx:388: in numcodecs.zstd.Zstd.decode
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   SystemError: Negative size passed to PyBytes_FromStringAndSize

numcodecs/zstd.pyx:229: SystemError
_________________________ test_streaming_decompression _________________________

    def test_streaming_decompression():
        # Test input frames with unknown frame content size
        codec = Zstd()
    
        # If the zstd command line interface is available, check the bytes
        cli = zstd_cli_available()
        if cli:
            view_zstd_streaming_bytes()
    
        # Encode bytes directly that were the result of streaming compression
        bytes_val = b'(\xb5/\xfd\x00Xa\x00\x00Hello World!'
>       dec = codec.decode(bytes_val)
              ^^^^^^^^^^^^^^^^^^^^^^^

numcodecs/tests/test_zstd.py:102: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
numcodecs/zstd.pyx:388: in numcodecs.zstd.Zstd.decode
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   SystemError: Negative size passed to PyBytes_FromStringAndSize

numcodecs/zstd.pyx:229: SystemError
----------------------------- Captured stdout call -----------------------------
    bytes_val = b'(\xb5/\xfd\x00Xa\x00\x00Hello world!'
    bytes3 = b'(\xb5/\xfd\x00X$\x02\x00\xa4\x03ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz\x01\x00:\xfc\xdfs\x05\x05L\x00\x00\x08s\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08k\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08c\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08[\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08S\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08K\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08C\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08u\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08m\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08e\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08]\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08U\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08M\x01\x00\xfc\xff9\x10\x02M\x00\x00\x08E\x01\x00\xfc\x7f\x1d\x08\x01'

---------- coverage: platform linux, python 3.13.6-final-0 -----------
Coverage XML written to file coverage.xml

=========================== short test summary info ============================
SKIPPED [2] numcodecs/tests/test_pcodec.py:7: pcodec not available
SKIPPED [2] numcodecs/tests/test_zfpy.py:11: ZFPY not available
SKIPPED [15] numcodecs/tests/test_blosc.py:62: codec has been removed
SKIPPED [1] numcodecs/tests/test_ndarray_like.py:8: could not import 'cupy': No module named 'cupy'
SKIPPED [1] numcodecs/tests/test_ndarray_like.py:20: could not import 'cupy': No module named 'cupy'
SKIPPED [1] numcodecs/tests/test_ndarray_like.py:32: could not import 'cupy': No module named 'cupy'
SKIPPED [1] numcodecs/tests/test_ndarray_like.py:44: could not import 'cupy': No module named 'cupy'
XFAIL numcodecs/tests/test_pyzstd.py::test_pyzstd_simple_multiple_frames_decode[Hello World!]
XFAIL numcodecs/tests/test_pyzstd.py::test_pyzstd_simple_multiple_frames_decode[\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00\x00\x05\x00\x00\x00\x06\x00\x00\x00\x07\x00\x00\x00\x08\x00\x00\x00\t\x00\x00\x00\n\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\r\x00\x00\x00\x0e\x00\x00\x00\x0f\x00\x00\x00\x10\x00\x00\x00\x11\x00\x00\x00\x12\x00\x00\x00\x13\x00\x00\x00\x14\x00\x00\x00\x15\x00\x00\x00\x16\x00\x00\x00\x17\x00\x00\x00\x18\x00\x00\x00\x19\x00\x00\x00\x1a\x00\x00\x00\x1b\x00\x00\x00\x1c\x00\x00\x00\x1d\x00\x00\x00\x1e\x00\x00\x00\x1f\x00\x00\x00 \x00\x00\x00!\x00\x00\x00"\x00\x00\x00#\x00\x00\x00$\x00\x00\x00%\x00\x00\x00&\x00\x00\x00'\x00\x00\x00(\x00\x00\x00)\x00\x00\x00*\x00\x00\x00+\x00\x00\x00,\x00\x00\x00-\x00\x00\x00.\x00\x00\x00/\x00\x00\x000\x00\x00\x001\x00\x00\x002\x00\x00\x003\x00\x00\x004\x00\x00\x005\x00\x00\x006\x00\x00\x007\x00\x00\x008\x00\x00\x009\x00\x00\x00:\x00\x00\x00;\x00\x00\x00<\x00\x00\x00=\x00\x00\x00>\x00\x00\x00?\x00\x00\x00@\x00\x00\x00A\x00\x00\x00B\x00\x00\x00C\x00\x00\x00D\x00\x00\x00E\x00\x00\x00F\x00\x00\x00G\x00\x00\x00H\x00\x00\x00I\x00\x00\x00J\x00\x00\x00K\x00\x00\x00L\x00\x00\x00M\x00\x00\x00N\x00\x00\x00O\x00\x00\x00P\x00\x00\x00Q\x00\x00\x00R\x00\x00\x00S\x00\x00\x00T\x00\x00\x00U\x00\x00\x00V\x00\x00\x00W\x00\x00\x00X\x00\x00\x00Y\x00\x00\x00Z\x00\x00\x00[\x00\x00\x00\\x00\x00\x00]\x00\x00\x00^\x00\x00\x00_\x00\x00\x00`\x00\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00d\x00\x00\x00e\x00\x00\x00f\x00\x00\x00g\x00\x00\x00h\x00\x00\x00i\x00\x00\x00j\x00\x00\x00k\x00\x00\x00l\x00\x00\x00m\x00\x00\x00n\x00\x00\x00o\x00\x00\x00p\x00\x00\x00]
XFAIL numcodecs/tests/test_pyzstd.py::test_pyzstd_simple_multiple_frames_decode[\n\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\r\x00\x00\x00\x0e\x00\x00\x00]
XFAIL numcodecs/tests/test_pyzstd.py::test_pyzstd_simple_multiple_frames_decode[+\x00*\x00\x1c\x00'\x00\x1c\x00\x0e\x00\r\x00#\x00*\x00!\x00(\x00\x05\x00\x16\x00$\x00\x11\x00\x13\x00\n\x00(\x00\t\x00\x10\x00\x0c\x00-\x00\x04\x00\x08\x00\x07\x00\x1f\x00\x16\x00\x15\x00\x08\x00\x07\x00\t\x00\x13\x00(\x000\x00\x11\x00\x0e\x00\x1b\x00\x1a\x00\x1b\x00-\x00\x15\x00\x1c\x00&\x00\x0c\x00,\x00\n\x00\x11\x00"\x00\x1b\x00-\x00'\x00\x1b\x00\n\x00]
FAILED numcodecs/tests/test_pyzstd.py::test_pyzstd_streaming[Hello World!] - SystemError: Negative size passed to PyBytes_FromStringAndSize
FAILED numcodecs/tests/test_pyzstd.py::test_pyzstd_streaming[\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00\x00\x05\x00\x00\x00\x06\x00\x00\x00\x07\x00\x00\x00\x08\x00\x00\x00\t\x00\x00\x00\n\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\r\x00\x00\x00\x0e\x00\x00\x00\x0f\x00\x00\x00\x10\x00\x00\x00\x11\x00\x00\x00\x12\x00\x00\x00\x13\x00\x00\x00\x14\x00\x00\x00\x15\x00\x00\x00\x16\x00\x00\x00\x17\x00\x00\x00\x18\x00\x00\x00\x19\x00\x00\x00\x1a\x00\x00\x00\x1b\x00\x00\x00\x1c\x00\x00\x00\x1d\x00\x00\x00\x1e\x00\x00\x00\x1f\x00\x00\x00 \x00\x00\x00!\x00\x00\x00"\x00\x00\x00#\x00\x00\x00$\x00\x00\x00%\x00\x00\x00&\x00\x00\x00'\x00\x00\x00(\x00\x00\x00)\x00\x00\x00*\x00\x00\x00+\x00\x00\x00,\x00\x00\x00-\x00\x00\x00.\x00\x00\x00/\x00\x00\x000\x00\x00\x001\x00\x00\x002\x00\x00\x003\x00\x00\x004\x00\x00\x005\x00\x00\x006\x00\x00\x007\x00\x00\x008\x00\x00\x009\x00\x00\x00:\x00\x00\x00;\x00\x00\x00<\x00\x00\x00=\x00\x00\x00>\x00\x00\x00?\x00\x00\x00@\x00\x00\x00A\x00\x00\x00B\x00\x00\x00C\x00\x00\x00D\x00\x00\x00E\x00\x00\x00F\x00\x00\x00G\x00\x00\x00H\x00\x00\x00I\x00\x00\x00J\x00\x00\x00K\x00\x00\x00L\x00\x00\x00M\x00\x00\x00N\x00\x00\x00O\x00\x00\x00P\x00\x00\x00Q\x00\x00\x00R\x00\x00\x00S\x00\x00\x00T\x00\x00\x00U\x00\x00\x00V\x00\x00\x00W\x00\x00\x00X\x00\x00\x00Y\x00\x00\x00Z\x00\x00\x00[\x00\x00\x00\\x00\x00\x00]\x00\x00\x00^\x00\x00\x00_\x00\x00\x00`\x00\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00d\x00\x00\x00e\x00\x00\x00f\x00\x00\x00g\x00\x00\x00h\x00\x00\x00i\x00\x00\x00j\x00\x00\x00k\x00\x00\x00l\x00\x00\x00m\x00\x00\x00n\x00\x00\x00o\x00\x00\x00p\x00\x00\x00] - SystemError: Negative size passed to PyBytes_FromStringAndSize
FAILED numcodecs/tests/test_pyzstd.py::test_pyzstd_streaming[\n\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\r\x00\x00\x00\x0e\x00\x00\x00] - SystemError: Negative size passed to PyBytes_FromStringAndSize
FAILED numcodecs/tests/test_pyzstd.py::test_pyzstd_streaming[+\x00*\x00\x1c\x00'\x00\x1c\x00\x0e\x00\r\x00#\x00*\x00!\x00(\x00\x05\x00\x16\x00$\x00\x11\x00\x13\x00\n\x00(\x00\t\x00\x10\x00\x0c\x00-\x00\x04\x00\x08\x00\x07\x00\x1f\x00\x16\x00\x15\x00\x08\x00\x07\x00\t\x00\x13\x00(\x000\x00\x11\x00\x0e\x00\x1b\x00\x1a\x00\x1b\x00-\x00\x15\x00\x1c\x00&\x00\x0c\x00,\x00\n\x00\x11\x00"\x00\x1b\x00-\x00'\x00\x1b\x00\n\x00] - SystemError: Negative size passed to PyBytes_FromStringAndSize
FAILED numcodecs/tests/test_zstd.py::test_streaming_decompression - SystemError: Negative size passed to PyBytes_FromStringAndSize
===== 5 failed, 685 passed, 23 skipped, 27 deselected, 4 xfailed in 18.72s =====

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions