Bug 2078515

Summary: python-pikepdf fails to build with Python 3.11: AttributeError: property of 'Page' object has no deleter
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-pikepdfAssignee: Lumír Balhar <lbalhar>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: lbalhar, mhroncok, python-sig, quantum.analyst, thrnciar, zdohnal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-22 19:06:11 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: 2016048    

Description Tomáš Hrnčiar 2022-04-25 13:33:54 UTC
python-pikepdf fails to build with Python 3.11.0a7.

=================================== FAILURES ===================================
_______________________________ test_page_attrs ________________________________
[gw0] linux -- Python 3.11.0 /usr/bin/python3

graph = <pikepdf.Pdf description='/builddir/build/BUILD/pikepdf-5.1.2/tests/resources/graph.pdf'>

    def test_page_attrs(graph):
        # Test __getattr__
        assert isinstance(graph.pages[0].Resources, Dictionary)
    
        del graph.pages[0].Resources
        with pytest.raises(AttributeError, match="can't delete"):
>           del graph.pages[0].obj

tests/test_page.py:263: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pikepdf.Page({
  "/Contents": pikepdf.Stream(owner=<...>, data=<...>, {
      "/Length": 44
    }),
  "/MediaBox": [ 0, 0, Decimal('545.2800'), Decimal('443.5200') ],
  "/Parent": <reference to /Pages>,
  "/Type": "/Page"
})>
name = 'obj'

    @augment_override_cpp
    def __delattr__(self, name):
        if hasattr(self.__class__, name):
>           return object.__delattr__(self, name)
E           AttributeError: property of 'Page' object has no deleter

../../BUILDROOT/python-pikepdf-5.1.2-1.fc37.x86_64/usr/lib64/python3.11/site-packages/pikepdf/_methods.py:1252: AttributeError

During handling of the above exception, another exception occurred:

graph = <pikepdf.Pdf description='/builddir/build/BUILD/pikepdf-5.1.2/tests/resources/graph.pdf'>

    def test_page_attrs(graph):
        # Test __getattr__
        assert isinstance(graph.pages[0].Resources, Dictionary)
    
        del graph.pages[0].Resources
>       with pytest.raises(AttributeError, match="can't delete"):
E       AssertionError: Regex pattern "can't delete" does not match "property of 'Page' object has no deleter".

tests/test_page.py:262: AssertionError
=========================== short test summary info ============================
SKIPPED [1] tests/test_image_access.py:738: jbig2dec not installed
SKIPPED [1] tests/test_image_access.py:753: jbig2dec not installed
SKIPPED [1] tests/test_image_access.py:744: jbig2dec not installed
SKIPPED [1] tests/test_image_access.py:762: jbig2dec not installed
SKIPPED [1] tests/test_pdfa.py:35: verapdf not found
SKIPPED [1] tests/test_pdfa.py:53: verapdf not found
SKIPPED [1] tests/test_pdfa.py:83: verapdf not found
SKIPPED [1] tests/test_private_pdfs.py:25: private resources not available
XFAIL tests/test_foreign.py::test_issue_271
  current qpdf behavior
FAILED tests/test_page.py::test_page_attrs - AssertionError: Regex pattern "c...
============= 1 failed, 501 passed, 8 skipped, 1 xfailed in 11.18s =============

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/04304273-python-pikepdf/

For all our attempts to build python-pikepdf with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/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.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
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 Elliott Sales de Andrade 2022-04-28 00:34:49 UTC
I don't see any entry for this change in the what's new, but I assume they did some re-writing of the exception text.

Comment 2 Lumír Balhar 2022-05-03 06:47:38 UTC
The failure is caused by this change in Python: https://github.com/python/cpython/commit/0cb765b2cec9b020224af016a83bf35c45b71932

The fix is pretty easy so I'm gonna report it to upstream today and I might prepare a fix as well.

Comment 3 Lumír Balhar 2022-05-03 10:41:13 UTC
Downstream PR: https://src.fedoraproject.org/rpms/python-pikepdf/pull-request/2

Comment 4 Miro Hrončok 2022-05-12 11:32:01 UTC
This fix was merged but I cannot verify it currently due to uninstallable matplotlib.

Comment 5 Tomáš Hrnčiar 2022-05-13 08:08:36 UTC
I managed to build matplotlib with tests in COPR, so I think we are good. 

https://download.copr.fedorainfracloud.org/results/@python/python3.11/fedora-rawhide-x86_64/04403772-python-matplotlib/builder-live.log.gz

It is still failing in the Koschei tho.

Comment 6 Elliott Sales de Andrade 2022-05-21 05:17:49 UTC
I don't see any failure for either in Koschei.

Comment 7 Lumír Balhar 2022-05-22 19:06:11 UTC
The last three builds of pikepdf are green in Python 3.11 COPR so this can be closed.

https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-pikepdf/