cairocffi
cairocffi copied to clipboard
AssertionError in test_png
In Fedora Rawhide we are starting to see:
___________________________________ test_png ___________________________________
def test_png():
pixbuf_obj, format_name = pixbuf.decode_to_pixbuf(JPEG_BYTES)
assert format_name == 'jpeg'
> assert_decoded(pixbuf.pixbuf_to_cairo_slices(pixbuf_obj),
constants.FORMAT_RGB24, b'\xff\x00\x80\xff')
../BUILDROOT/usr/lib/python3.14/site-packages/cairocffi/test_pixbuf.py:67:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pixbuf = <cairocffi.pixbuf.Pixbuf object at 0xffffaa772ea0>
def pixbuf_to_cairo_slices(pixbuf):
"""Convert from PixBuf to ImageSurface, using slice-based byte swapping.
This method is 2~5x slower than GDK but does not support an alpha channel.
(cairo uses pre-multiplied alpha, but not Pixbuf.)
"""
assert pixbuf.get_colorspace() == gdk_pixbuf.GDK_COLORSPACE_RGB
> assert pixbuf.get_n_channels() == 3
E AssertionError
../BUILDROOT/usr/lib/python3.14/site-packages/cairocffi/pixbuf.py:157: AssertionError
Looks like may have started with the update of gdk-pixbuf2 from 2.42.12-10.fc42 to 2.43.3-4.fc43, but could have been a number of other things, see https://koschei.fedoraproject.org/package/python-cairocffi?collection=f43
I suppose that it’s related to the new Glycin loader. What’s the value of pixbuf.get_n_channels()? The JPEG testing image really has 3 channels.
It’s a "bug" in the Glycin loader, fixed 2 weeks ago. I think that we can close this issue and wait for the next version if it’s OK for you.