[Django] #32969: Improve pickling of HttpResponse instances

4 views
Skip to first unread message

Django

unread,
Jul 28, 2021, 2:44:55 PM7/28/21
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
------------------------------------------------+------------------------
Reporter: zatro | Owner: nobody
Type: Bug | Status: new
Component: Core (Serialization) | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
When pickling a HTTPResponse, rather than pickling all of its attributes
just store what is needed for the creation of a new HttpResponse with the
correct content, status code and headers.

See related discussion on ticket #23895 and its PR.

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

Django

unread,
Jul 29, 2021, 12:08:28 AM7/29/21
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------+------------------------------------

Reporter: zatro | Owner: nobody
Type: Bug | Status: new
Component: HTTP handling | Version: dev
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):

* component: Core (Serialization) => HTTP handling
* stage: Unreviewed => Accepted


Comment:

Thanks, it's worth adding that pickling `HttpResponse` with CBV crashes:
{{{
>>> import pickle
>>> response = self.client.get('/cbv_view/')
>>> pickle.dumps(response)
...
AttributeError: Can't pickle ....
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:1>

Django

unread,
Aug 1, 2021, 9:22:13 AM8/1/21
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------+------------------------------------
Reporter: zatro | Owner: tigicion
Type: Bug | Status: assigned

Component: HTTP handling | Version: dev
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 tigicion):

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


--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:2>

Django

unread,
Aug 2, 2021, 9:22:58 PM8/2/21
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------+------------------------------------
Reporter: zatro | Owner: tigicion
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
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 tigicion):

* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/14728

--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:3>

Django

unread,
Aug 4, 2021, 9:55:01 AM8/4/21
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------+------------------------------------
Reporter: zatro | Owner: tigicion
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
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


Comment:

I agree with
[https://github.com/django/django/pull/14728#discussion_r682556877 Keryn's
comment].

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

Django

unread,
Aug 6, 2021, 2:22:29 AM8/6/21
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------+-------------------------------------
Reporter: zatro | Owner: Ruoxu Hua

Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
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 Ruoxu Hua):

* needs_better_patch: 1 => 0


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

Django

unread,
Sep 5, 2021, 7:21:35 AM9/5/21
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------+------------------------------------
Reporter: zatro | Owner: tigicion
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
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 Keryn Knight):

* cc: Keryn Knight (added)


* needs_better_patch: 0 => 1


Comment:

Tentatively setting the flag back; I've left feedback and proposed a first
sketch of how adapting `SimpleTemplateResponse` and `TemplateResponse`
might go.

--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:6>

Django

unread,
Sep 6, 2021, 4:52:19 AM9/6/21
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------+------------------------------------
Reporter: zatro | Owner: tigicion
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

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

* needs_tests: 0 => 1


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

Django

unread,
Jun 14, 2022, 12:47:40 AM6/14/22
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------+-----------------------------------------
Reporter: zatro | Owner: Anvesh Mishra

Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------------------------
Changes (by Anvesh Mishra):

* cc: Anvesh Mishra (added)
* owner: tigicion => Anvesh Mishra


--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:8>

Django

unread,
Jun 16, 2022, 4:07:03 PM6/16/22
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------+-----------------------------------------
Reporter: zatro | Owner: Anvesh Mishra
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------------------------

Comment (by Anvesh Mishra):

Submitted the [https://github.com/django/django/pull/15777 PR] with all
the suggested changes according to Keryn and Felix's comments on
[https://github.com/django/django/pull/14728 PR-14728]

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

Django

unread,
Jun 20, 2022, 2:52:30 AM6/20/22
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------------+-------------------------------------

Reporter: zatro | Owner: Anvesh
| Mishra
Type: Bug | Status: assigned
Component: HTTP handling | Version: dev
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):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:10>

Django

unread,
Jun 20, 2022, 7:11:19 AM6/20/22
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------------+-------------------------------------
Reporter: zatro | Owner: Anvesh
| Mishra
Type: Bug | Status: closed

Component: HTTP handling | Version: dev
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:"d7f5bfd241666c0a76e90208da1e9ef81aec44db" d7f5bfd]:
{{{
#!CommitTicketReference repository=""
revision="d7f5bfd241666c0a76e90208da1e9ef81aec44db"
Fixed #32969 -- Fixed pickling HttpResponse and subclasses.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:11>

Django

unread,
Jun 20, 2022, 7:11:38 AM6/20/22
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------------+-------------------------------------
Reporter: zatro | Owner: Anvesh
Type: | Mishra
Cleanup/optimization | Status: closed

Component: HTTP handling | Version: dev
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):

* type: Bug => Cleanup/optimization


--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:12>

Django

unread,
Apr 12, 2023, 12:52:57 PM4/12/23
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------------+-------------------------------------
Reporter: zatro | Owner: Anvesh
Type: | Mishra
Cleanup/optimization | Status: closed
Component: HTTP handling | Version: dev
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 Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"173034b00589c083793d495e8b07e35be2cb1cf0" 173034b0]:
{{{
#!CommitTicketReference repository=""
revision="173034b00589c083793d495e8b07e35be2cb1cf0"
Refs #34482 -- Reverted "Fixed #32969 -- Fixed pickling HttpResponse and
subclasses."

This reverts commit d7f5bfd241666c0a76e90208da1e9ef81aec44db.

Thanks Márton Salomváry for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:13>

Django

unread,
Apr 12, 2023, 12:54:31 PM4/12/23
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------------+-------------------------------------
Reporter: zatro | Owner: Anvesh
Type: | Mishra
Cleanup/optimization | Status: closed
Component: HTTP handling | Version: dev
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 Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"791407fef16faa4da6fe2247c24a9055037dd5dd" 791407f]:
{{{
#!CommitTicketReference repository=""
revision="791407fef16faa4da6fe2247c24a9055037dd5dd"
[4.2.x] Refs #34482 -- Reverted "Fixed #32969 -- Fixed pickling
HttpResponse and subclasses."

This reverts commit d7f5bfd241666c0a76e90208da1e9ef81aec44db.

Thanks Márton Salomváry for the report.

Backport of 173034b00589c083793d495e8b07e35be2cb1cf0 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:14>

Django

unread,
Apr 12, 2023, 12:56:23 PM4/12/23
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------------+-------------------------------------
Reporter: zatro | Owner: Anvesh
Type: | Mishra
Cleanup/optimization | Status: new

Component: HTTP handling | Version: dev
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):

* status: closed => new
* has_patch: 1 => 0
* resolution: fixed =>
* stage: Ready for checkin => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:15>

Django

unread,
Mar 18, 2024, 2:43:46 AM3/18/24
to django-...@googlegroups.com
#32969: Improve pickling of HttpResponse instances
-------------------------------------+-------------------------------------
Reporter: zatro | Owner: Anvesh
Type: | Mishra
Cleanup/optimization | Status: new
Component: HTTP handling | Version: dev
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 Ülgen Sarıkavak):

* cc: Ülgen Sarıkavak (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/32969#comment:16>
Reply all
Reply to author
Forward
0 new messages