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 1895298 - PyQt4 fails to build with Python 3.10: Please migrate to new buffer protocol
Summary: PyQt4 fails to build with Python 3.10: Please migrate to new buffer protocol
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: PyQt4
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Rex Dieter
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2020-11-06 09:34 UTC by Tomáš Hrnčiar
Modified: 2020-12-08 11:32 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-12-08 11:32:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2020-11-06 09:34:15 UTC
PyQt4 fails to build with Python 3.10.0a1.

In file included from /usr/include/QtCore/QString:1,
                 from ../../../qpy/QtCore/qpycore_qstring.cpp:24:
/usr/include/QtCore/qstring.h: In member function 'int QStringRef::compare(QLatin1String, Qt::CaseSensitivity) const':
/usr/include/QtCore/qstring.h:1254:62: warning: implicitly-declared 'constexpr QLatin1String::QLatin1String(const QLatin1String&)' is deprecated [-Wdeprecated-copy]
 1254 | { return QString::compare_helper(constData(), length(), s, cs); }
      |                                                              ^
/usr/include/QtCore/qstring.h:658:27: note: because 'QLatin1String' has user-provided 'QLatin1String& QLatin1String::operator=(const QLatin1String&)'
  658 |     inline QLatin1String &operator=(const QLatin1String &other)
      |                           ^~~~~~~~
/usr/include/QtCore/qstring.h:634:45: note:   initializing argument 3 of 'static int QString::compare_helper(const QChar*, int, QLatin1String, Qt::CaseSensitivity)'
  634 |                               QLatin1String s2,
      |                               ~~~~~~~~~~~~~~^~
/usr/include/QtCore/qstring.h: In static member function 'static int QStringRef::compare(const QStringRef&, QLatin1String, Qt::CaseSensitivity)':
/usr/include/QtCore/qstring.h:1260:69: warning: implicitly-declared 'constexpr QLatin1String::QLatin1String(const QLatin1String&)' is deprecated [-Wdeprecated-copy]
 1260 | { return QString::compare_helper(s1.constData(), s1.length(), s2, cs); }
      |                                                                     ^
/usr/include/QtCore/qstring.h:658:27: note: because 'QLatin1String' has user-provided 'QLatin1String& QLatin1String::operator=(const QLatin1String&)'
  658 |     inline QLatin1String &operator=(const QLatin1String &other)
      |                           ^~~~~~~~
/usr/include/QtCore/qstring.h:634:45: note:   initializing argument 3 of 'static int QString::compare_helper(const QChar*, int, QLatin1String, Qt::CaseSensitivity)'
  634 |                               QLatin1String s2,
      |                               ~~~~~~~~~~~~~~^~
/usr/include/QtCore/qstring.h: In member function 'QBool QStringRef::contains(QLatin1String, Qt::CaseSensitivity) const':
/usr/include/QtCore/qstring.h:1278:32: warning: implicitly-declared 'constexpr QLatin1String::QLatin1String(const QLatin1String&)' is deprecated [-Wdeprecated-copy]
 1278 | { return QBool(indexOf(s, 0, cs) != -1); }
      |                                ^
/usr/include/QtCore/qstring.h:658:27: note: because 'QLatin1String' has user-provided 'QLatin1String& QLatin1String::operator=(const QLatin1String&)'
  658 |     inline QLatin1String &operator=(const QLatin1String &other)
      |                           ^~~~~~~~
/usr/include/QtCore/qstring.h:1125:31: note:   initializing argument 1 of 'int QStringRef::indexOf(QLatin1String, int, Qt::CaseSensitivity) const'
 1125 |     int indexOf(QLatin1String str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
      |                 ~~~~~~~~~~~~~~^~~
../../../qpy/QtCore/qpycore_qstring.cpp: In function 'const char* qpycore_encode(PyObject**, QCoreApplication::Encoding)':
../../../qpy/QtCore/qpycore_qstring.cpp:301:14: error: 'PyObject_AsCharBuffer' was not declared in this scope; did you mean 'PyObject_CheckBuffer'?
  301 |     else if (PyObject_AsCharBuffer(obj, &es, &sz) >= 0)
      |              ^~~~~~~~~~~~~~~~~~~~~
      |              PyObject_CheckBuffer
make[2]: *** [Makefile:447: qpycore_qstring.o] Error 1

https://docs.python.org/3.10/whatsnew/changelog.html#id11

bpo-41103: PyObject_AsCharBuffer(), PyObject_AsReadBuffer(), PyObject_CheckReadBuffer(), and PyObject_AsWriteBuffer() are removed. Please migrate to new buffer protocol; PyObject_GetBuffer() and PyBuffer_Release().

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

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

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 Victor Stinner 2020-11-23 17:28:30 UTC
PyQt4 is no longer supported upstream: PyQt4 version 4.12.3 is the last version of PyQt4.

"This is the last release of PyQt4. No more releases will be made."
https://riverbankcomputing.com/software/pyqt/download

---

It seems like the stable version is now PyQt5: "PyQt5 is a comprehensive set of Python bindings for Qt v5."

PyQt5 is packaged in Fedora as: https://src.fedoraproject.org/rpms/python-qt5/blob/master/f/python-qt5.spec

I don't know if Qt5 is backward compatible with Qt4.

Is it possible to consider removing the PyQt4 package in Rawhide? The following packages require PyQt4:

* PyMca
* flatcam
* ibus-bogo
* pymol
* python-pyqtgraph
* python-qdarkstyle
* python3-PyQt4-devel
* python3-PyQt4-webkit
* python3-cclib
* python3-iep
* python3-matplotlib-qt4
* python3-pyqtgraph
* python3-pyudev-qt4

---

The issue comes from qpycore_encode() function of PyQt4. First of all, this function is deprecated:
"#if QT_DEPRECATED_SINCE(5, 0)"

Morever, qpycore_encode() has been removed from PyQt5. PyQt 5.15.1 doesn't use PyObject_AsBuffer() anymore (the discussed function removed in Python 3.10).

---

The Fedora package uses PyQt4 version 4.12.3 since August 2018:

* Fri Aug 31 2018 Rex Dieter <rdieter> - 4.12.3-1
- 4.12.3

Comment 2 Victor Stinner 2020-11-23 17:46:11 UTC
I'm working on a fix: https://src.fedoraproject.org/rpms/PyQt4/pull-request/2


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