Re: [Django] #36922: AttributeError: 'tuple' object has no attribute 'extend' when using Exists

0 views
Skip to first unread message

Django

unread,
Feb 12, 2026, 8:43:58 AM (yesterday) Feb 12
to django-...@googlegroups.com
#36922: AttributeError: 'tuple' object has no attribute 'extend' when using Exists
-------------------------------------+-------------------------------------
Reporter: Julien Palard | Owner: (none)
Type: Bug | Status: closed
Component: Database layer | Version: 6.0
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls):

Hang on, I'm pretty close to reverse engineering a failing case.
--
Ticket URL: <https://code.djangoproject.com/ticket/36922#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 12, 2026, 10:13:37 AM (yesterday) Feb 12
to django-...@googlegroups.com
#36922: AttributeError: 'tuple' object has no attribute 'extend' when using Exists
-------------------------------------+-------------------------------------
Reporter: Julien Palard | Owner: (none)
Type: Bug | Status: closed
Component: Database layer | Version: 6.0
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* resolution: needsinfo => invalid

Comment:

Okay, I couldn't engineer a failing case. Please reopen if you can find
one using no third-party packages.

I think your problem is that `django-oscar` is subclassing `StartsWith` to
create a reverse starts with by [https://github.com/django-oscar/django-
oscar/blob/de217920de717fa894e40f425bfd61bc800721a2/src/oscar/apps/catalogue/abstract_models.py#L69
swapping `lhs_params` and `rhs_params`].

The 6.0 version of `StartsWith` is safe, because it calls `extend()` on
the params returned by `process_lhs()`, which is always a list. If you
change the return type of an internal by swapping the implementations like
this, all bets are off. You could vendor the more resilient version from
main, which is pretty much the advice in the release note you linked to
(always return params in a tuple from custom ORM expressions).
--
Ticket URL: <https://code.djangoproject.com/ticket/36922#comment:7>
Reply all
Reply to author
Forward
0 new messages