{{{
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.
* Attachment "minimal_example.diff" added.
Patch to create a minimal example.
* Attachment "testserver_output.log" added.
Output of Django's testserver, including the traceback.
* Attachment "minimal_example.diff" added.
Patch to create a minimal example.
--
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>
* 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>