Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1808343 - libxml2 fails to build with Python 3.9: python/libxml.c:297:37: error: expected ';' before '{' token
Summary: libxml2 fails to build with Python 3.9: python/libxml.c:297:37: error: expect...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: libxml2
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Igor Raits
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON39
TreeView+ depends on / blocked
 
Reported: 2020-02-28 09:50 UTC by Miro Hrončok
Modified: 2020-03-05 14:12 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-05 14:12:04 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNOME Gitlab GNOME/libxml2 - merge_requests 71 0 None None None 2020-02-28 11:51:48 UTC
GNOME Gitlab GNOME libxml2 issues 149 0 None None None 2020-02-28 11:41:27 UTC

Description Miro Hrončok 2020-02-28 09:50:01 UTC
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) {
      |    

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01255332-libxml2/

For all our attempts to build libxml2 with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/libxml2/

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.9:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.9.
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 Petr Viktorin 2020-02-28 10:20:27 UTC
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.


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