Bug 1906380

Summary: python-alsa fails to build with Python 3.10: PyList_SET_ITEM(), PyTuple_SET_ITEM() and PyCell_SET() macros can no longer be used as l-value or r-value.
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-alsaAssignee: Gwyn Ciesla <gwync>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: andy.shevchenko, gwync, jkysela, mhroncok, robinlee.sysu, thrnciar, vstinner
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-14 10:00:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1890881    

Description Tomáš Hrnčiar 2020-12-10 11:57:54 UTC
python-alsa fails to build with Python 3.10.0a3.

In file included from /usr/include/python3.10/tupleobject.h:39,
                 from /usr/include/python3.10/Python.h:105,
                 from pyalsa/common.h:25,
                 from pyalsa/alsahcontrol.c:22:
pyalsa/alsahcontrol.c: In function ‘element_callback’:
/usr/include/python3.10/cpython/tupleobject.h:26:36: error: void value not ignored as it ought to be
   26 | #define PyTuple_SET_ITEM(op, i, v) ((void)(_PyTuple_CAST(op)->ob_item[i] = v))
      |                                    ^
pyalsa/alsahcontrol.c:1546:21: note: in expansion of macro ‘PyTuple_SET_ITEM’
 1546 |                 if (PyTuple_SET_ITEM(t, 0, (PyObject *)pyhelem))
      |                     ^~~~~~~~~~~~~~~~
error: command '/usr/bin/gcc' failed with exit code 1

bpo-30459: PyList_SET_ITEM(), PyTuple_SET_ITEM() and PyCell_SET() macros can no longer be used as l-value or r-value. For example, x = PyList_SET_ITEM(a, b, c) and PyList_SET_ITEM(a, b, c) = x now fail with a compiler error. It prevents bugs like if (PyList_SET_ITEM (a, b, c) < 0) ... test. Patch by Zackery Spytz and Victor Stinner.

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

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

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 Jaroslav Kysela 2020-12-10 15:24:34 UTC
Apply also commit a64a6cc703d08db5c223a16bf812a569534ba464 (alsaseq: fix constant objects in Python)

https://github.com/alsa-project/alsa-python/commit/a64a6cc703d08db5c223a16bf812a569534ba464

Comment 2 Jaroslav Kysela 2020-12-10 15:28:06 UTC
The correct patch subject mentioned in comment#1 is "alsaseq: fix constant objects in Python 3", sorry.

Comment 3 Victor Stinner 2020-12-14 09:58:22 UTC
> Apply also commit a64a6cc703d08db5c223a16bf812a569534ba464 (alsaseq: fix constant objects in Python)

This change looks unrelated, whereas the following change fix this BZ:
https://github.com/alsa-project/alsa-python/commit/5ea2f8709b4d091700750661231f8a3ddce0fc7c