Bug 2458684 - python-django-cacheops fails to build with Python 3.15: IssueTests.test_365 and BasicTests.test_subquery fail
Summary: python-django-cacheops fails to build with Python 3.15: IssueTests.test_365 ...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-django-cacheops
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ali Erdinc Koroglu
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.15
TreeView+ depends on / blocked
 
Reported: 2026-04-15 13:41 UTC by Karolina Surma
Modified: 2026-04-15 13:41 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

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.


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