Bug 2264851 - pycairo fails to build with Python 3.13: SystemError: /builddir/build/BUILD/Python-3.13.0a4/Objects/abstract.c:430: bad argument to internal function
Summary: pycairo fails to build with Python 3.13: SystemError: /builddir/build/BUILD/P...
Keywords:
Status: POST
Alias: None
Product: Fedora
Classification: Fedora
Component: pycairo
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Kalev Lember
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2024-02-19 10:02 UTC by Karolina Surma
Modified: 2024-05-29 19:28 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources pycairo pull-request 8 0 None None None 2024-05-29 19:28:29 UTC
Github pygobject pycairo issues 365 0 None open Python 3.13.0b1: SystemError: Objects/abstract.c:430: bad argument to internal function 2024-05-29 15:20:34 UTC
Github pygobject pycairo pull 366 0 None open Avoid invalid PyBUF_READ flag in PyObject_GetBuffer() 2024-05-29 19:28:29 UTC

Description Karolina Surma 2024-02-19 10:02:41 UTC
pycairo fails to build with Python 3.13.0a4.

=================================== FAILURES ===================================
__________________ test_surface_get_set_mime_data_references ___________________

    @pytest.mark.skipif(not hasattr(sys, "getrefcount"), reason="PyPy")
    def test_surface_get_set_mime_data_references():
        surface = cairo.ImageSurface(cairo.FORMAT_RGB24, 1, 1)
        v = memoryview(b"bla")
        x = v[:1]
        recfcount_v = sys.getrefcount(v)
        recfcount_x = sys.getrefcount(x)
        assert recfcount_v == recfcount_x
>       surface.set_mime_data("foo", v)
E       SystemError: /builddir/build/BUILD/Python-3.13.0a4/Objects/abstract.c:430: bad argument to internal function

tests/test_api.py:282: SystemError
________________________ test_surface_mime_data_for_pdf ________________________

    @pytest.mark.skipif(
        sysconfig.get_platform().startswith("win"), reason="msvc fixme")
    def test_surface_mime_data_for_pdf():
        jpeg_bytes = zlib.decompress(base64.b64decode(
            b'eJz7f+P/AwYBLzdPNwZGRkYGDyBk+H+bwRnEowj8P8TAzcHACDJHkOH/EQYRIBsV'
            b'cP6/xcDBCBJlrLcHqRBAV8EAVcHIylSPVwGbPQEFjPaK9XDrBAipBSq4CQB9jiS0'
        ))
    
        file_like = io.BytesIO()
        surface = cairo.PDFSurface(file_like, 3, 3)
        context = cairo.Context(surface)
        image = cairo.ImageSurface(cairo.FORMAT_RGB24, 1, 1)
>       image.set_mime_data(cairo.MIME_TYPE_JPEG, jpeg_bytes)
E       SystemError: /builddir/build/BUILD/Python-3.13.0a4/Objects/abstract.c:430: bad argument to internal function

tests/test_api.py:308: SystemError
________________________ test_surface_get_set_mime_data ________________________

    def test_surface_get_set_mime_data():
        surface = cairo.ImageSurface(cairo.FORMAT_RGB24, 1, 1)
        assert surface.get_mime_data("foo") is None
        assert surface.get_mime_data(cairo.MIME_TYPE_JPEG) is None
    
>       surface.set_mime_data("foo", b"bar")
E       SystemError: /builddir/build/BUILD/Python-3.13.0a4/Objects/abstract.c:430: bad argument to internal function

tests/test_surface.py:478: SystemError
=========================== short test summary info ============================
FAILED tests/test_api.py::test_surface_get_set_mime_data_references - SystemE...
FAILED tests/test_api.py::test_surface_mime_data_for_pdf - SystemError: /buil...
FAILED tests/test_surface.py::test_surface_get_set_mime_data - SystemError: /...
=================== 3 failed, 268 passed, 3 skipped in 0.48s ===================
https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/07033691-pycairo/

For all our attempts to build pycairo with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/pycairo/

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

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
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 Miro Hrončok 2024-05-29 15:06:11 UTC
This is blocking pygobject3, which is blocking 100+ other packages.

Comment 2 Miro Hrončok 2024-05-29 15:11:02 UTC
Updating to 1.26.0 does not help.

Comment 3 Miro Hrončok 2024-05-29 15:20:35 UTC
Reported upstream at https://github.com/pygobject/pycairo/issues/365

Comment 4 Miro Hrončok 2024-05-29 17:37:56 UTC
(In reply to Miro Hrončok from comment #1)
> This is blocking pygobject3, which is blocking 100+ other packages.

Also transitively blocks python-pillow which is needed by 200+.


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