public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Ali Erdinc Koroglu <ali.koroglu@oss.qualcomm.com>
To: git-commits@fedoraproject.org
Subject: [rpms/python-django-cacheops] rawhide: RHBZ #2458684
Date: Thu, 18 Jun 2026 19:45:44 GMT	[thread overview]
Message-ID: <178181194489.1.14529387715550235486.rpms-python-django-cacheops-f27386798e23@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/python-django-cacheops
Branch : rawhide
Commit : f27386798e238a3979b81861a7611ee8337e4d65
Author : Ali Erdinc Koroglu <ali.koroglu@oss.qualcomm.com>
Date   : 2026-06-18T22:45:29+03:00
Stats  : +61/-2 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/python-django-cacheops/c/f27386798e238a3979b81861a7611ee8337e4d65?branch=rawhide

Log:
RHBZ #2458684

---
diff --git a/fix-subquery-annotation.patch b/fix-subquery-annotation.patch
new file mode 100644
index 0000000..0125db5
--- /dev/null
+++ b/fix-subquery-annotation.patch
@@ -0,0 +1,33 @@
+From 2142bf8997b15dc1906fbfd226635449fb93f6f9 Mon Sep 17 00:00:00 2001
+From: Audrius Masalskis <audrius@gigpro.com>
+Date: Wed, 4 Mar 2026 10:29:12 +0200
+Subject: [PATCH] Fix Subquery annotation detection in dnfs() for Django 6.0+
+
+Django 6.0 resolves Subquery annotations into raw Query objects
+in qs.query.annotations. The existing isinstance(q, Subquery)
+check misses these, causing cross-table Subquery dependencies
+to be invisible to cache invalidation.
+
+Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
+---
+diff --git a/cacheops/tree.py b/cacheops/tree.py
+index 6334ac7..de2638d 100644
+--- a/cacheops/tree.py
++++ b/cacheops/tree.py
+@@ -159,9 +159,13 @@ def dnfs(qs):
+ 
+     # Add any subqueries used for annotation
+     if qs.query.annotations:
+-        subqueries = (query_dnf(getattr(q, 'query', None))
+-                      for q in qs.query.annotations.values() if isinstance(q, Subquery))
+-        dnfs_.update(join_with(lcat, subqueries))
++        sub_dnfs = []
++        for q in qs.query.annotations.values():
++            if isinstance(q, Subquery):
++                sub_dnfs.append(query_dnf(getattr(q, 'query', None)))
++            elif isinstance(q, Query):
++                sub_dnfs.append(query_dnf(q))
++        dnfs_.update(join_with(lcat, sub_dnfs) or {})
+ 
+     return dnfs_
+ 

diff --git a/python-django-cacheops.spec b/python-django-cacheops.spec
index 3c0ef9a..b2e37ad 100644
--- a/python-django-cacheops.spec
+++ b/python-django-cacheops.spec
@@ -16,13 +16,16 @@ And there is more to it:
 
 Name:           python-%{srcname}
 Version:        7.2
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        ORM cache with automatic granular event-driven invalidation for Django
 
 License:        BSD-3-Clause
 URL:            https://github.com/Suor/%{srcname}
 Source:         %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz
 
+Patch0:		fix-subquery-annotation.patch
+Patch1:		test_subquery-dj6.patch
+
 BuildArch:      noarch
 
 BuildRequires:	python3-devel
@@ -39,7 +42,7 @@ Summary:        %{summary}
 %description -n python3-%{srcname} %{desc}
 
 %prep
-%autosetup -n %{srcname}-%{version}
+%autosetup -p1 -n %{srcname}-%{version}
 
 %generate_buildrequires
 %pyproject_buildrequires
@@ -77,6 +80,9 @@ cat $PWD/redis.log
 %doc README.rst CHANGELOG
 
 %changelog
+* Thu Jun 18 2026 Ali Erdinc Koroglu <ali.koroglu@oss.qualcomm.com> - 7.2-5
+- Backported upstream commit 2142bf8 for rhbz#2458684
+
 * Sat Jun 06 2026 Python Maint <python-maint@redhat.com> - 7.2-4
 - Rebuilt for Python 3.15
 

diff --git a/test_subquery-dj6.patch b/test_subquery-dj6.patch
new file mode 100644
index 0000000..09951e4
--- /dev/null
+++ b/test_subquery-dj6.patch
@@ -0,0 +1,20 @@
+On Django 6.0 a Subquery built from a queryset using .only('id') no
+longer auto-resolves its output_field, raising OutputFieldIsNoneError
+when used as the target of an __in lookup. Per Django's documentation,
+a Subquery used in __in must return exactly one column, which is done
+with .values('id') rather than .only('id'). This is a test-only fix;
+cacheops behaviour is unchanged.
+---
+diff --git a/tests/tests.py b/tests/tests.py
+index f450cf4..ac3c812 100644
+--- a/tests/tests.py
++++ b/tests/tests.py
+@@ -179,7 +179,7 @@ class BasicTests(BaseTestCase):
+             list(Post.objects.filter(category=2).cache())
+ 
+     def test_subquery(self):
+-        categories = Category.objects.cache().filter(title='Django').only('id')
++        categories = Category.objects.cache().filter(title='Django').values('id')
+         Post.objects.cache().filter(category__in=Subquery(categories)).count()
+ 
+     def test_rawsql(self):

                 reply	other threads:[~2026-06-18 19:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178181194489.1.14529387715550235486.rpms-python-django-cacheops-f27386798e23@fedoraproject.org \
    --to=ali.koroglu@oss.qualcomm.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox