Bug 2359815

Summary: python-pikepdf fails to build with Python 3.14: Test failures related to refcounting
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-pikepdfAssignee: Elliott Sales de Andrade <quantum.analyst>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: epel-packagers-sig, mhroncok, python-packagers-sig, quantum.analyst, zdohnal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-pikepdf-9.9.0-3.fc43 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-06-25 01:56:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2322407    

Description Karolina Surma 2025-04-15 17:45:53 UTC
python-pikepdf fails to build with Python 3.14.0a7.

__________________________ test_copy_foreign_refcount __________________________
[gw1] linux -- Python 3.14.0 /usr/bin/python3

refcount = <built-in function getrefcount>
vera = <pikepdf.Pdf description='/builddir/build/BUILD/python-pikepdf-9.5.2-build/pikepdf-9.5.2/tests/resources/veraPDF test suite 6-2-10-t02-pass-a.pdf'>
outlines = <pikepdf.Pdf description='/builddir/build/BUILD/python-pikepdf-9.5.2-build/pikepdf-9.5.2/tests/resources/outlines.pdf'>

    def test_copy_foreign_refcount(refcount, vera, outlines):
>       assert refcount(outlines.Root.Names) == 2
E       assert 1 == 2
E        +  where 1 = <built-in function getrefcount>(<pikepdf.Dictionary({\n  "/Dests": {\n    "/Kids": [ {\n      "/Limits": [ "0", "1" ],\n      "/Names": [ "0", [ <Pdf.page...29'), Decimal('607.2'), None ] ]\n    }, {\n      "/Limits": [ "4", <...> ],\n      "/Names": <...>\n    }, <...> ]\n  }\n})>)
E        +    where <pikepdf.Dictionary({\n  "/Dests": {\n    "/Kids": [ {\n      "/Limits": [ "0", "1" ],\n      "/Names": [ "0", [ <Pdf.page...29'), Decimal('607.2'), None ] ]\n    }, {\n      "/Limits": [ "4", <...> ],\n      "/Names": <...>\n    }, <...> ]\n  }\n})> = <pikepdf.Dictionary(Type="/Catalog")({\n  "/Names": {\n    "/Dests": {\n      "/Kids": [ {\n        "/Limits": [ "0", "1" .../UseOutlines",\n  "/Pages": {\n    "/Count": <...>,\n    "/Kids": <...>,\n    "/Type": <...>\n  },\n  "/Type": "/Catalog"\n})>.Names
E        +      where <pikepdf.Dictionary(Type="/Catalog")({\n  "/Names": {\n    "/Dests": {\n      "/Kids": [ {\n        "/Limits": [ "0", "1" .../UseOutlines",\n  "/Pages": {\n    "/Count": <...>,\n    "/Kids": <...>,\n    "/Type": <...>\n  },\n  "/Type": "/Catalog"\n})> = <pikepdf.Pdf description='/builddir/build/BUILD/python-pikepdf-9.5.2-build/pikepdf-9.5.2/tests/resources/outlines.pdf'>.Root

tests/test_foreign.py:102: AssertionError
_______________________ TestStream.test_stream_refcount ________________________
[gw1] linux -- Python 3.14.0 /usr/bin/python3

self = <test_object.TestStream object at 0x7f981e890500>
refcount = <built-in function getrefcount>
outpdf = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/popen-gw1/test_stream_refcount0/out.pdf')

    def test_stream_refcount(self, refcount, outpdf):
        pdf = pikepdf.new()
        stream = Stream(pdf, b'blahblah')
>       assert refcount(stream) == 2
E       assert 1 == 2
E        +  where 1 = <built-in function getrefcount>(<pikepdf.Stream(owner=<...>, data=b'blahblah', {\n  "/Length": 8\n})>)

tests/test_object.py:595: AssertionError
___________________________ test_evil_page_deletion ____________________________
[gw1] linux -- Python 3.14.0 /usr/bin/python3

refcount = <built-in function getrefcount>
resources = PosixPath('/builddir/build/BUILD/python-pikepdf-9.5.2-build/pikepdf-9.5.2/tests/resources')
outdir = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/popen-gw1/test_evil_page_deletion0')

    def test_evil_page_deletion(refcount, resources, outdir):
        copy(resources / 'sandwich.pdf', outdir / 'sandwich.pdf')
    
        src = Pdf.open(outdir / 'sandwich.pdf')  # no with clause
        pdf = Pdf.open(resources / 'graph.pdf')
    
>       assert refcount(src) == 2
E       AssertionError: assert 1 == 2
E        +  where 1 = <built-in function getrefcount>(<pikepdf.Pdf description='/tmp/pytest-of-mockbuild/pytest-0/popen-gw1/test_evil_page_deletion0/sandwich.pdf'>)


https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/build/8905534/

For all our attempts to build python-pikepdf with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-pikepdf/

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

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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.