Bug 2336891

Summary: python-rdflib fails to build with Python 3.14: "TypeError: '<' not supported between instances of 'Literal' and 'Literal'"
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-rdflibAssignee: Nils Philippsen <nphilipp>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 43CC: djc, ksurma, mhroncok, mtasaka, negativo17, nphilipp, pingou
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-rdflib-7.1.4-3.fc43 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-08-27 21:43:00 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, 2372245    

Description Karolina Surma 2025-01-10 09:48:12 UTC
python-rdflib fails to build with Python 3.14.0a3.

11 tests fail with what boils down to:
"TypeError: '<' not supported between instances of 'Literal' and 'Literal'"

Details:
_ test_entry_sparql11[http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#plus-2] _

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f343246d630>
exit_stack = <contextlib.ExitStack object at 0x7f3427513570>
manifest_entry = SPARQLEntry(manifest=Manifest(uri_mapper=URIMapper(mappings={URIMapping(remote='http://www.w3.org/2009/sparql/docs/tes.../www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/plus-2.srx'), result_graph_data=None, expected_outcome=None)

    @pytest.mark.parametrize(
        ["manifest_entry"],
        params_from_sources(
            MAPPER,
            SPARQLEntry,
            LOCAL_BASE_DIR / "manifest-all.ttl",
            mark_dict=MARK_DICT,
            markers=(
                lambda entry: pytest.mark.skip(reason="tester not implemented")
                if entry.type in SKIP_TYPES
                else None,
            ),
            report_prefix="rdflib_w3c_sparql11",
        ),
    )
    def test_entry_sparql11(
        monkeypatch: MonkeyPatch, exit_stack: ExitStack, manifest_entry: SPARQLEntry
    ) -> None:
>       check_entry(monkeypatch, exit_stack, manifest_entry)

test/test_w3c_spec/test_sparql11_w3c.py:266: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test/utils/sparql_checker.py:430: in check_entry
    return check_query(exit_stack, entry)
test/utils/sparql_checker.py:355: in check_query
    result = dataset.query(query_text, base=query_base)
rdflib/graph.py:1565: in query
    return result(processor.query(query_object, initBindings, initNs, **kwargs))  # type: ignore[arg-type]
rdflib/plugins/sparql/processor.py:146: in query
    return evalQuery(self.graph, strOrQuery, initBindings, base)
rdflib/plugins/sparql/evaluate.py:695: in evalQuery
    return evalPart(ctx, main)
rdflib/plugins/sparql/evaluate.py:319: in evalPart
    return evalSelectQuery(ctx, part)
rdflib/plugins/sparql/evaluate.py:570: in evalSelectQuery
    res["bindings"] = evalPart(ctx, query.p)
rdflib/plugins/sparql/evaluate.py:303: in evalPart
    return evalProject(ctx, part)
rdflib/plugins/sparql/evaluate.py:561: in evalProject
    res = evalPart(ctx, project.p)
rdflib/plugins/sparql/evaluate.py:312: in evalPart
    return evalOrderBy(ctx, part)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ctx = <rdflib.plugins.sparql.sparql.QueryContext object at 0x7f342c6373d0>
part = OrderBy_{'p': Extend_{'p': BGP_{'triples': [(rdflib.term.Variable('s'), rdflib.term.URIRef('http://example/p'), rdflib..._vars': {rdflib.term.Variable('sum'), rdflib.term.Variable('y'), rdflib.term.Variable('s'), rdflib.term.Variable('x')}}

    def evalOrderBy(
        ctx: QueryContext, part: CompValue
    ) -> Generator[FrozenBindings, None, None]:
        res = evalPart(ctx, part.p)
    
        for e in reversed(part.expr):
            reverse = bool(e.order and e.order == "DESC")
>           res = sorted(
                res, key=lambda x: _val(value(x, e.expr, variables=True)), reverse=reverse
            )
E           TypeError: '<' not supported between instances of 'Literal' and 'Literal'


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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08480280-python-rdflib/

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

Comment 1 Aoife Moloney 2025-02-26 13:22:03 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.