Bug 1899866 - python-zstd fails to build with Python 3.10: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
Summary: python-zstd fails to build with Python 3.10: SystemError: PY_SSIZE_T_CLEAN m...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-zstd
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Neal Gompa
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2020-11-20 09:38 UTC by Tomáš Hrnčiar
Modified: 2021-02-09 16:23 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2020-11-20 09:38:34 UTC
python-zstd fails to build with Python 3.10.0a2.

======================================================================
ERROR: test_compression_default_level (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
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 "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 19, in test_compression_default_level
    BaseTestZSTD.helper_compression_default_level(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 71, in helper_compression_default_level
    CDATA = zstd.compress(tDATA)
SystemError: <built-in function compress> returned a result with an error set

======================================================================
ERROR: test_compression_default_level_default (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
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 "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 25, in test_compression_default_level_default
    BaseTestZSTD.helper_compression_default_level_default(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 79, in helper_compression_default_level_default
    CDATA = zstd.compress(tDATA)
SystemError: <built-in function compress> returned a result with an error set

======================================================================
ERROR: test_compression_default_level_zero (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
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 "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 22, in test_compression_default_level_zero
    BaseTestZSTD.helper_compression_default_level_zero(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 75, in helper_compression_default_level_zero
    CDATA = zstd.compress(tDATA)
SystemError: <built-in function compress> returned a result with an error set

======================================================================
ERROR: test_compression_level1 (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 48, in test_compression_level1
    BaseTestZSTD.helper_compression_level1(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 119, in helper_compression_level1
    self.assertEqual(DATA, zstd.decompress(zstd.compress(DATA, 1)))
TypeError: a bytes-like object is required, not 'int'

======================================================================
ERROR: test_compression_level20 (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 54, in test_compression_level20
    BaseTestZSTD.helper_compression_level20(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 133, in helper_compression_level20
    self.assertEqual(DATA, zstd.decompress(zstd.compress(DATA, 20)))
TypeError: a bytes-like object is required, not 'int'

======================================================================
ERROR: test_compression_level6 (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 51, in test_compression_level6
    BaseTestZSTD.helper_compression_level6(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 126, in helper_compression_level6
    self.assertEqual(DATA, zstd.decompress(zstd.compress(DATA, 6)))
TypeError: a bytes-like object is required, not 'int'

======================================================================
ERROR: test_compression_multi_thread_many (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 40, in test_compression_multi_thread_many
    BaseTestZSTD.helper_compression_multi_thread_many(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 104, in helper_compression_multi_thread_many
    CDATA = zstd.compress(tDATA, 6, 16)
TypeError: a bytes-like object is required, not 'int'

======================================================================
ERROR: test_compression_multi_thread_one (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 37, in test_compression_multi_thread_one
    BaseTestZSTD.helper_compression_multi_thread_one(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 100, in helper_compression_multi_thread_one
    CDATA = zstd.compress(tDATA, 6, 1)
TypeError: a bytes-like object is required, not 'int'

======================================================================
ERROR: test_compression_negative_level (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 28, in test_compression_negative_level
    BaseTestZSTD.helper_compression_negative_level(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 86, in helper_compression_negative_level
    CDATA = zstd.compress(tDATA, -1)
TypeError: a bytes-like object is required, not 'int'

======================================================================
ERROR: test_compression_negative_level_notdefault (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 31, in test_compression_negative_level_notdefault
    BaseTestZSTD.helper_compression_negative_level_notdefault(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 93, in helper_compression_negative_level_notdefault
    CDATA = zstd.compress(tDATA, -1)
TypeError: a bytes-like object is required, not 'int'

======================================================================
ERROR: test_compression_random (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
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 "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 16, in test_compression_random
    BaseTestZSTD.helper_compression_random(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 68, in helper_compression_random
    self.assertEqual(DATA, zstd.loads(zstd.dumps(DATA)))
SystemError: <built-in function dumps> returned a result with an error set

======================================================================
ERROR: test_compression_wrong_level (tests.test_compress.TestZSTD)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/test_compress.py", line 34, in test_compression_wrong_level
    BaseTestZSTD.helper_compression_wrong_level(self)
  File "/builddir/build/BUILD/zstd-1.4.5.1/tests/base.py", line 97, in helper_compression_wrong_level
    self.assertRaises(zstd.Error, zstd.compress, tDATA, 100)
  File "/usr/lib64/python3.10/unittest/case.py", line 732, in assertRaises
    return context.handle('assertRaises', args, kwargs)
  File "/usr/lib64/python3.10/unittest/case.py", line 201, in handle
    callable_obj(*args, **kwargs)
TypeError: a bytes-like object is required, not 'int'

----------------------------------------------------------------------
Ran 15 tests in 0.019s

FAILED (errors=12, skipped=3)

https://docs.python.org/3.10/whatsnew/3.10.html#id2

The PY_SSIZE_T_CLEAN macro must now be defined to use PyArg_ParseTuple() and Py_BuildValue() formats which use #: es#, et#, s#, u#, y#, z#, U# and Z#. See Parsing arguments and building values and the PEP 353.
https://docs.python.org/3.10/c-api/arg.html#arg-parsing
https://www.python.org/dev/peps/pep-0353
https://bugs.python.org/issue40943

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01773497-python-zstd/

For all our attempts to build python-zstd with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-zstd/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Ben Cotton 2021-02-09 15:26:24 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.


Note You need to log in before you can comment on or make changes to this bug.