[Django] #29411: Pickling of a form fails after a form was used in a template

17 views
Skip to first unread message

Django

unread,
May 16, 2018, 11:14:40 AM5/16/18
to django-...@googlegroups.com
#29411: Pickling of a form fails after a form was used in a template
-------------------------------------------+------------------------
Reporter: Torsten Bronger | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 2.0
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 |
-------------------------------------------+------------------------
The following view function fails from its second invocation on:

{{{
def main(request):
import django.forms as forms
import pickle
pickle.dump(forms.Form(), open("/dev/null", "wb")) # This fails, but
not at the very first invocation.
return render(request, "main.html", {"example_form": ExampleForm()})
}}}

Steps to reproduce:

1. `django-admin startproject pickle_problem`
2. `cd pickle_problem`
3. Apply the attached patch with `-p1`.
4. Apply migrations, start testserver.
5. Open the URL “/” on the testserver. You should see a bogus form with
one boolean field.
6. Reload the page.

What happens:

The pickling of `form.Form()` fails. See the attached traceback.

I observe this problem since Django 1.11. Up to Django 1.10, it has
worked fine for me.

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

Django

unread,
May 16, 2018, 11:16:08 AM5/16/18
to django-...@googlegroups.com
#29411: Pickling of a form fails after a form was used in a template
---------------------------------+--------------------------------------

Reporter: Torsten Bronger | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 2.0
Severity: Normal | Resolution:

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 Torsten Bronger):

* Attachment "minimal_example.diff" added.

Patch to create a minimal example.

Django

unread,
May 16, 2018, 11:17:30 AM5/16/18
to django-...@googlegroups.com
#29411: Pickling of a form fails after a form was used in a template
---------------------------------+--------------------------------------

Reporter: Torsten Bronger | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 2.0
Severity: Normal | Resolution:

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 Torsten Bronger):

* Attachment "testserver_output.log" added.

Output of Django's testserver, including the traceback.

Django

unread,
May 16, 2018, 3:46:48 PM5/16/18
to django-...@googlegroups.com
#29411: Pickling of a form fails after a form was used in a template
---------------------------------+--------------------------------------

Reporter: Torsten Bronger | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 2.0
Severity: Normal | Resolution:

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 Torsten Bronger):

* Attachment "minimal_example.diff" added.

Patch to create a minimal example.

--

Django

unread,
May 16, 2018, 4:05:11 PM5/16/18
to django-...@googlegroups.com
#29411: Pickling of a form fails after a form was used in a template
---------------------------------+--------------------------------------

Reporter: Torsten Bronger | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 2.0
Severity: Normal | Resolution:

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 Torsten Bronger):

With the following view function, the error can be reproduced without
reloading the page, which may be easier for automatic reproducing:

{{{
def main(request):


pickle.dump(forms.Form(), open("/dev/null", "wb"))

result = render(request, "main.html", {"example_form": ExampleForm()})


pickle.dump(forms.Form(), open("/dev/null", "wb"))

return result
}}}

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

Django

unread,
May 17, 2018, 2:43:17 AM5/17/18
to django-...@googlegroups.com
#29411: Pickling of a form fails after a form was used in a template
---------------------------------+--------------------------------------

Reporter: Torsten Bronger | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 2.0
Severity: Normal | Resolution: duplicate

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 Carlton Gibson):

* status: new => closed
* resolution: => duplicate


Comment:

This looks like a duplicate of #28223. (The traceback error is the same as
reported there.)

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

Reply all
Reply to author
Forward
0 new messages