Bug 2458684

Summary: python-django-cacheops fails to build with Python 3.15: IssueTests.test_365 and BasicTests.test_subquery fail
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-django-cacheopsAssignee: Ali Erdinc Koroglu <aekoroglu>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: aekoroglu, ksurma, mhroncok, python-packagers-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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: 2412434    

Description Karolina Surma 2026-04-15 13:41:42 UTC
python-django-cacheops fails to build with Python 3.15.0a8.

___________________________ BasicTests.test_subquery ___________________________

self = <tests.tests.BasicTests testMethod=test_subquery>

    def test_subquery(self):
        categories = Category.objects.cache().filter(title='Django').only('id')
>       Post.objects.cache().filter(category__in=Subquery(categories)).count()
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/tests.py:183: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.15/site-packages/django/db/models/query.py:1542: in filter
    return self._filter_or_exclude(False, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.15/site-packages/django/db/models/query.py:1560: in _filter_or_exclude
    clone._filter_or_exclude_inplace(negate, args, kwargs)
/usr/lib/python3.15/site-packages/django/db/models/query.py:1570: in _filter_or_exclude_inplace
    self._query.add_q(Q(*args, **kwargs))
/usr/lib/python3.15/site-packages/django/db/models/sql/query.py:1676: in add_q
    clause, _ = self._add_q(q_object, can_reuse)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.15/site-packages/django/db/models/sql/query.py:1708: in _add_q
    child_clause, needed_inner = self.build_filter(
/usr/lib/python3.15/site-packages/django/db/models/sql/query.py:1565: in build_filter
    value = self.resolve_lookup_value(value, can_reuse, allow_joins, summarize)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.15/site-packages/django/db/models/sql/query.py:1330: in resolve_lookup_value
    value = value.resolve_expression(
/usr/lib/python3.15/site-packages/django/db/models/expressions.py:1804: in resolve_expression
    self.output_field
/usr/lib/python3.15/site-packages/django/utils/functional.py:47: in __get__
    res = instance.__dict__[self.name] = self.func(instance)
                                         ^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <django.db.models.expressions.Subquery object at 0x7fa1af0be120>

    @cached_property
    def output_field(self):
        """Return the output type of this expressions."""
        output_field = self._resolve_output_field()
        if output_field is None:
>           raise OutputFieldIsNoneError(
                "Cannot resolve expression type, unknown output_field"
            )
E           django.db.models.expressions.OutputFieldIsNoneError: Cannot resolve expression type, unknown output_field

/usr/lib/python3.15/site-packages/django/db/models/expressions.py:330: OutputFieldIsNoneError
_____________________________ IssueTests.test_365 ______________________________

self = <tests.tests.IssueTests testMethod=test_365>

    def test_365(self):
        """
        Check that an annotated Subquery is automatically invalidated.
        """
        # Retrieve all Categories and annotate the ID of the most recent Post for each
        newest_post = Post.objects.filter(category=OuterRef('pk')).order_by('-pk').values('pk')
        categories = Category.objects.cache().annotate(newest_post=Subquery(newest_post[:1]))
    
        # Create a new Post in the first Category
        post = Post(category=categories[0], title='Foo')
        post.save()
    
        # Retrieve Categories again, and check that the newest post ID is correct
        categories = Category.objects.cache().annotate(newest_post=Subquery(newest_post[:1]))
>       self.assertEqual(categories[0].newest_post, post.pk)
E       AssertionError: 1 != 4

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.15/fedora-rawhide-x86_64/10318672-python-django-cacheops/

For all our attempts to build python-django-cacheops with Python 3.15, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15/package/python-django-cacheops/

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

Let us know here if you have any questions.

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