Re: [Django] #35073: models.SET's callable is called when there are no objects to update.

21 views
Skip to first unread message

Django

unread,
Jan 1, 2024, 11:49:21 AM1/1/24
to django-...@googlegroups.com
#35073: models.SET's callable is called when there are no objects to update.
-------------------------------------+-------------------------------------
Reporter: Fabio Sangiovanni | Owner: O'ktamjon
Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(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 Simon Charette):

* stage: Unreviewed => Accepted


Comment:

We should fix that.

I think the most straightforward solution is to only set `lazy_sub_objs =
True` on the function returned by `SET` if the value is not a callable.
The same problem exists for `SET_DEFAULT` when the default is callable.

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

Django

unread,
Jan 26, 2024, 12:15:56 PM1/26/24
to django-...@googlegroups.com
#35073: models.SET's callable is called when there are no objects to update.
-------------------------------------+-------------------------------------
Reporter: Fabio Sangiovanni | Owner: O'ktamjon
Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(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 bcail):

* cc: bcail (added)

Comment:

@O'ktamjon are you still working on this? If not, I can work on it.
--
Ticket URL: <https://code.djangoproject.com/ticket/35073#comment:4>

Django

unread,
Feb 2, 2024, 11:35:44 AM2/2/24
to django-...@googlegroups.com
#35073: models.SET's callable is called when there are no objects to update.
-------------------------------------+-------------------------------------
Reporter: Fabio Sangiovanni | Owner: O'ktamjon
Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(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 bcail):

I opened an [https://github.com/django/django/pull/17812 in-progress PR]
with two unit tests, for SET and SET_DEFAULT.

I pinged Simon on the PR, because I haven't figured out how to fix
SET_DEFAULT yet.
--
Ticket URL: <https://code.djangoproject.com/ticket/35073#comment:5>

Django

unread,
Feb 5, 2024, 9:27:54 AM2/5/24
to django-...@googlegroups.com
#35073: models.SET's callable is called when there are no objects to update.
-------------------------------------+-------------------------------------
Reporter: Fabio Sangiovanni | Owner: O'ktamjon
Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1

Comment:

I updated the PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/35073#comment:6>

Django

unread,
Feb 8, 2024, 2:50:53 AM2/8/24
to django-...@googlegroups.com
#35073: models.SET's callable is called when there are no objects to update.
-------------------------------------+-------------------------------------
Reporter: Fabio Sangiovanni | Owner: O'ktamjon
Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/35073#comment:7>

Django

unread,
Feb 8, 2024, 9:26:39 AM2/8/24
to django-...@googlegroups.com
#35073: models.SET's callable is called when there are no objects to update.
-------------------------------------+-------------------------------------
Reporter: Fabio Sangiovanni | Owner: O'ktamjon
Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by bcail):

* needs_better_patch: 1 => 0

Comment:

I updated the PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/35073#comment:8>

Django

unread,
Feb 8, 2024, 12:41:10 PM2/8/24
to django-...@googlegroups.com
#35073: models.SET's callable is called when there are no objects to update.
-------------------------------------+-------------------------------------
Reporter: Fabio Sangiovanni | Owner: bcail

Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(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: O'ktamjon => bcail
* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/35073#comment:9>

Django

unread,
Feb 8, 2024, 12:41:42 PM2/8/24
to django-...@googlegroups.com
#35073: models.SET's callable is called when there are no objects to update.
-------------------------------------+-------------------------------------
Reporter: Fabio Sangiovanni | Owner: bcail
Type: Bug | Status: closed

Component: Database layer | Version: 4.2
(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 GitHub <noreply@…>):

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

Comment:

In [changeset:"9c5e382b981608a26f2c55f1259d9e823fee5f15" 9c5e382b]:
{{{#!CommitTicketReference repository=""
revision="9c5e382b981608a26f2c55f1259d9e823fee5f15"
Fixed #35073 -- Avoided unnecessary calling of callables used by
SET/SET_DEFAULT in Collector.collect().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35073#comment:10>

Reply all
Reply to author
Forward
0 new messages