Bug 2283518 - python-rdflib fails to build with Python 3.13: AttributeError: '_pickle.Pickler' object attribute 'persistent_id' is read-only
Summary: python-rdflib fails to build with Python 3.13: AttributeError: '_pickle.Pickl...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: python-rdflib
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nils Philippsen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2291894 (view as bug list)
Depends On:
Blocks: MultimediaSIG F41FTBFS F41FailsToInstall PYTHON3.13 2291678 2291804 2291828 2291850 2291921 2292024 2292523
TreeView+ depends on / blocked
 
Reported: 2024-05-27 15:26 UTC by Karolina Surma
Modified: 2024-06-16 08:13 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-06-16 08:13:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources python-rdflib pull-request 5 0 None None None 2024-06-13 08:36:17 UTC
Github RDFLib rdflib issues 2801 0 None open TestUtil.test_to_bits_from_bits_round_trip test failure with python3.13b2 2024-06-14 09:54:05 UTC

Description Karolina Surma 2024-05-27 15:26:29 UTC
python-rdflib fails to build with Python 3.13.0b1.


__________________ TestUtil.test_to_bits_from_bits_round_trip __________________

self = <test_nodepickler.TestUtil object at 0x7f5277295810>

        def test_to_bits_from_bits_round_trip(self):
            np = NodePickler()
    
            a = Literal(
                """A test with a \\n (backslash n), "\u00a9" , and newline \n and a second line.
    """
            )
>           b = np.loads(np.dumps(a))

test/test_store/test_nodepickler.py:32: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <rdflib.store.NodePickler object at 0x7f52751b1fd0>
obj = rdflib.term.Literal('A test with a \\n (backslash n), "©" , and newline \n and a second line.\n')
protocol = None, bin = None

    def dumps(
        self, obj: "Node", protocol: Optional[Any] = None, bin: Optional[Any] = None
    ):
        src = BytesIO()
        p = Pickler(src)
        # NOTE on type error: https://github.com/python/mypy/issues/2427
        # type error: Cannot assign to a method
>       p.persistent_id = self._get_ids  # type: ignore[assignment]
E       AttributeError: '_pickle.Pickler' object attribute 'persistent_id' is read-only

rdflib/store.py:149: AttributeError
_________________________ TestUtil.test_literal_cases __________________________

self = <test_nodepickler.TestUtil object at 0x7f5277295950>

    def test_literal_cases(self):
        np = NodePickler()
    
        for l in cases:
            a = Literal(l)
>           b = np.loads(np.dumps(a))

test/test_store/test_nodepickler.py:40: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <rdflib.store.NodePickler object at 0x7f5273890a50>
obj = rdflib.term.Literal('no quotes'), protocol = None, bin = None

    def dumps(
        self, obj: "Node", protocol: Optional[Any] = None, bin: Optional[Any] = None
    ):
        src = BytesIO()
        p = Pickler(src)
        # NOTE on type error: https://github.com/python/mypy/issues/2427
        # type error: Cannot assign to a method
>       p.persistent_id = self._get_ids  # type: ignore[assignment]
E       AttributeError: '_pickle.Pickler' object attribute 'persistent_id' is read-only

FAILED test/test_store/test_nodepickler.py::TestUtil::test_to_bits_from_bits_round_trip
FAILED test/test_store/test_nodepickler.py::TestUtil::test_literal_cases - At...

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/07495797-python-rdflib/

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

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 Karolina Surma 2024-06-12 15:06:55 UTC
*** Bug 2291894 has been marked as a duplicate of this bug. ***

Comment 2 Michel Lind 2024-06-13 08:36:18 UTC
I have a hacky patch that gets this to build, but

a) I can't figure out what announced change in Python 3.13 causes this behavior (pickle.{Pickler,Unpickler} methods not being overrideable without subclassing)
b) this leaks new class definitions (which I indicate are not meant to be public by underscores, but still) so probably should not be merged as is, but should be reported upstream by one of the package maintainers

https://src.fedoraproject.org/rpms/python-rdflib/pull-request/5

Comment 4 Dominik 'Rathann' Mierzejewski 2024-06-14 09:51:28 UTC
FYI this is causing ffmpeg to FTBFS (via lv2-devel).

Comment 5 Fedora Fails To Install 2024-06-16 08:13:47 UTC
Hello,

Please note that this comment was generated automatically by https://pagure.io/releng/blob/main/f/scripts/ftbfs-fti/follow-policy.py
If you feel that this output has mistakes, please open an issue at https://pagure.io/releng/

All subpackages of a package against which this bug was filled are now installable or removed from Fedora 41.

Thanks for taking care of it!


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