Re: [Django] #35099: Combining QuerySets with "|" or "&" mutates right-hand side.

10 views
Skip to first unread message

Django

unread,
Jan 10, 2024, 4:37:21 AM1/10/24
to django-...@googlegroups.com
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-------------------------------------+-------------------------------------
Reporter: Alan | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Alan):

Replying to [comment:2 Mariusz Felisiak]:
> Does it work for you? Would you like to prepare a patch? (a regression
test is required).

It does work for me, the test now passes correctly after applying cloning
the rhs.

Regarding the patch, I've never contributed to Django, so it may take
quite a while for me to get familiar with what's required. If you could
point me to the key resources on how to do that, I may take a shot on a
weekend.

I found a "Submitting a patches" in Django doc. I need more guidance on
how to cover this case with regression tests. I would highly appreciate
some references to take a look at.

--
Ticket URL: <https://code.djangoproject.com/ticket/35099#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 10, 2024, 4:44:14 AM1/10/24
to django-...@googlegroups.com
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-------------------------------------+-------------------------------------
Reporter: Alan | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

> Regarding the patch, I've never contributed to Django, so it may take
quite a while for me to get familiar with what's required. If you could
point me to the key resources on how to do that, I may take a shot on a
weekend.

Great, thanks! I'd recommend joining our [https://discord.gg/xcRH6mN4fa
Discord server] and asking on the `#contributing-getting-started` channel,
folks are very helpful there.

--
Ticket URL: <https://code.djangoproject.com/ticket/35099#comment:4>

Django

unread,
Jan 10, 2024, 5:36:38 AM1/10/24
to django-...@googlegroups.com
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-------------------------------------+-------------------------------------
Reporter: Alan | Owner: Alan
Type: Bug | Status: assigned

Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => Alan
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/35099#comment:5>

Django

unread,
Feb 7, 2024, 5:02:03 AM2/7/24
to django-...@googlegroups.com
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-------------------------------------+-------------------------------------
Reporter: Alan | Owner: Hisham
| Mahmood

Type: Bug | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: Alan => Hisham Mahmood
* has_patch: 0 => 1
* stage: Accepted => Ready for checkin

Comment:

[https://github.com/django/django/pull/17829 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/35099#comment:6>

Django

unread,
Feb 7, 2024, 7:18:13 AM2/7/24
to django-...@googlegroups.com
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-------------------------------------+-------------------------------------
Reporter: Alan | Owner: Hisham
| Mahmood
Type: Bug | Status: closed

Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed

Comment:

In [changeset:"d79fba7d8e7bbcdf53535a14d57ead5a6863cd8d" d79fba7d]:
{{{#!CommitTicketReference repository=""
revision="d79fba7d8e7bbcdf53535a14d57ead5a6863cd8d"
Fixed #35099 -- Prevented mutating queryset when combining with & and |
operators.

Thanks Alan for the report.

Co-authored-by: Mariusz Felisiak <felisiak...@gmail.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35099#comment:7>

Django

unread,
Feb 7, 2024, 12:51:55 PM2/7/24
to django-...@googlegroups.com
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-------------------------------------+-------------------------------------
Reporter: Alan | Owner: Hisham
| Mahmood
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Alan):

Thank you, Hisham Mahmood and Mariusz, for picking this up.

Sorry for leaving this hanging. I got overwhelmed on my main job, so
wasn't able to find a spare hour for this.
--
Ticket URL: <https://code.djangoproject.com/ticket/35099#comment:8>

Reply all
Reply to author
Forward
0 new messages