Python 3.9.0a4: python/libxml.c:297:37: error: expected ';' before '{' token - PyUnicode_Check (ret) not parenthesized
libxml2 fails to build with Python 3.9.0a4.
/usr/include/python3.9/object.h:623:41: error: expected '(' before 'PyType_HasFeature'
623 | #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
| ^~~~~~~~~~~~~~~~~
/usr/include/python3.9/unicodeobject.h:115:18: note: in expansion of macro 'PyType_FastSubclass'
115 | PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
| ^~~~~~~~~~~~~~~~~~~
../../python/libxml.c:297:15: note: in expansion of macro 'PyUnicode_Check'
297 | } else if PyUnicode_Check (ret) {
| ^~~~~~~~~~~~~~~
../../python/libxml.c:297:37: error: expected ';' before '{' token
297 | } else if PyUnicode_Check (ret) {
| ^
../../python/libxml.c: In function 'xmlPythonFileRead':
../../python/libxml.c:354:5: warning: 'PyEval_CallMethod' is deprecated [-Wdeprecated-declarations]
354 | ret = PyEval_CallMethod(file, (char *) "io_read", (char *) "(i)", len);
| ^~~
In file included from /usr/include/python3.9/Python.h:141,
from ../../python/libxml.c:14:
/usr/include/python3.9/ceval.h:28:43: note: declared here
28 | Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallMethod(
| ^~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.9/pytime.h:6,
from /usr/include/python3.9/Python.h:85,
from ../../python/libxml.c:14:
/usr/include/python3.9/object.h:623:41: error: expected '(' before 'PyType_HasFeature'
623 | #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
| ^~~~~~~~~~~~~~~~~
/usr/include/python3.9/unicodeobject.h:115:18: note: in expansion of macro 'PyType_FastSubclass'
115 | PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
| ^~~~~~~~~~~~~~~~~~~
../../python/libxml.c:362:15: note: in expansion of macro 'PyUnicode_Check'
362 | } else if PyUnicode_Check (ret) {
| ^~~~~~~~~~~~~~~
../../python/libxml.c:362:37: error: expected ';' before '{' token
362 | } else if PyUnicode_Check (ret) {
|
In C, if
expressions should be parenthesized, so that line should read:
} else if (PyUnicode_Check (ret)) {
I guess PyUnicode_Check
happened to expand to a parenthesized expression before, but that's not API to rely on.
Fedora downstream report: https://bugzilla.redhat.com/show_bug.cgi?id=1808343
I'm am working on a merge request.