Leaklens

django__django-13406

Queryset with values()/values_list() crashes when recreated from a pickled query.

Verdict: the issue text repeats lines of the gold patch (Tier C).

We could set _iterable_class when query.values_select is not empty: diff --git a/django/db/models/query.py b/django/db/models/query.py index b48d0df9c0..85cd8311a7 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -210,6 +210,8 @@ class QuerySet: @query.setter def query(self, value): + if value.values_select: + self._iterable_class = ValuesIterable self._query = value def as_manager(cls):

2 of 2 added patch lines appear in the issue or discussion.

All SWE-bench Verified tasks · more django/django tasks · How the check works