python-cvxopt fails to build with Python 3.10.0a6. gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -I/usr/include/python3.10 -c src/C/base.c -o build/temp.linux-x86_64-3.10/src/C/base.o In file included from /usr/include/python3.10/Python.h:87, from src/C/base.c:24: src/C/base.c: In function ‘get_id’: /usr/include/python3.10/object.h:242:38: error: expected ‘(’ before ‘_PyObject_TypeCheck’ 242 | #define PyObject_TypeCheck(ob, type) _PyObject_TypeCheck(_PyObject_CAST(ob), type) | ^~~~~~~~~~~~~~~~~~~ src/C/cvxopt.h:73:28: note: in expansion of macro ‘PyObject_TypeCheck’ 73 | #define Matrix_Check(self) PyObject_TypeCheck(self, &matrix_tp) | ^~~~~~~~~~~~~~~~~~ src/C/base.c:356:8: note: in expansion of macro ‘Matrix_Check’ 356 | if Matrix_Check((PyObject *)val) | ^~~~~~~~~~~~ src/C/base.c:371:1: warning: control reaches end of non-void function [-Wreturn-type] 371 | } | ^ error: command '/usr/bin/gcc' failed with exit code 1 I don't know exactly what changed in Python here, but will check. For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/02083694-python-cvxopt/ For all our attempts to build python-cvxopt with Python 3.10, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-cvxopt/ 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.
Python 3.9 object.h includes this: #define PyObject_TypeCheck(ob, tp) \ (Py_IS_TYPE(ob, tp) || PyType_IsSubtype(Py_TYPE(ob), (tp))) Python 3.10 object.h changes that to: static inline int _PyObject_TypeCheck(PyObject *ob, PyTypeObject *type) { return Py_IS_TYPE(ob, type) || PyType_IsSubtype(Py_TYPE(ob), type); } #define PyObject_TypeCheck(ob, type) _PyObject_TypeCheck(_PyObject_CAST(ob), type) and cvxopt.h has: #define Matrix_Check(self) PyObject_TypeCheck(self, &matrix_tp) So this code in cvxopt's base.c function: if Matrix_Check((PyObject *)val) used to expand to an expression in parentheses, but now it doesn't. The cvxopt authors just need to wrap the "if" expression in parentheses and all will be well again. I will contact upstream.
Indeed: https://docs.python.org/3.10/whatsnew/changelog.html """Convert PyObject_TypeCheck() macro to a static inline function.""" https://bugs.python.org/issue43181 Thanks.
https://github.com/cvxopt/cvxopt/pull/190 I will add that patch and kick off a Rawhide build.
Patched version built in Rawhide.
As always, works like a charm. Thanks, Jerry!