Segfault when constructing QImage in PyQt6

RoadrunnerWMC roadrunnerwmc at
Fri Oct 15 07:14:57 BST 2021

Hi Phil,

I believe I found a bug in PyQt6. Test case is very simple:

from PyQt6 import QtCore, QtGui, QtWidgets

app = QtWidgets.QApplication([])

img = QtGui.QImage(b'\xff' * (256 * 256 * 4), 256, 256,
> QtGui.QImage.Format.Format_ARGB32)'test.png')

In PyQt5 5.15.4 (adjust the import line to test it), this correctly saves a
white 256x256 png in the current directory.
In PyQt6 6.2.0 on Ubuntu 20.04, this segfaults on the last line.
In PyQt6 6.2.0 on Windows 10, it doesn't crash, but the output is a corrupt
image (example attached). I can also make it sometimes do the same on
Ubuntu by playing with the QImage constructor arguments.

Let me know if you need any more info.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_win.png
Type: image/png
Size: 61333 bytes
Desc: not available
URL: <>

More information about the PyQt mailing list