#27202: yaml dump for django.forms.Field crashes with "TypeError: can't pickle 
int
objects"
-------------------------------+--------------------
     Reporter:  semenov        |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  1.8
     Severity:  Normal         |   Keywords:  yaml
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 Django 1.7.10, PyYAML 3.11 (Python 3.4):

 {{{
 >>> import yaml
 >>> from django import forms
 >>> yaml.dump(forms.ChoiceField)
 "!!python/name:django.forms.fields.ChoiceField ''\n"
 }}}

 Django 1.8.14, PyYAML 3.11 (Python 3.5):

 {{{
 >>> import yaml
 >>> from django import forms
 >>> yaml.dump(forms.ChoiceField)
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/Users/semenov/work/test/var/venv/lib/python3.5/site-
 packages/yaml/__init__.py", line 200, in dump
     return dump_all([data], stream, Dumper=Dumper, **kwds)
   File "/Users/semenov/work/test/var/venv/lib/python3.5/site-
 packages/yaml/__init__.py", line 188, in dump_all
     dumper.represent(data)
   File "/Users/semenov/work/test/var/venv/lib/python3.5/site-
 packages/yaml/representer.py", line 26, in represent
     node = self.represent_data(data)
   File "/Users/semenov/work/test/var/venv/lib/python3.5/site-
 packages/yaml/representer.py", line 51, in represent_data
     node = self.yaml_multi_representers[data_type](self, data)
   File "/Users/semenov/work/test/var/venv/lib/python3.5/site-
 packages/yaml/representer.py", line 313, in represent_object
     reduce = data.__reduce_ex__(2)
   File "/Users/semenov/work/test/var/venv/lib/python3.5/copyreg.py", line
 65, in _reduce_ex
     raise TypeError("can't pickle %s objects" % base.__name__)
 TypeError: can't pickle int objects
 }}}

 Anything we can do to have Django class types YAML-compatible again?

--
Ticket URL: <https://code.djangoproject.com/ticket/27202>
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.89b3d59507c5e56063cd72b5efc51e72%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to