#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.5ca2346a28d0104d1db71364e90b2a9a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to