Message4115
There are problems pickling instances of Django's MultiValueDict, only
when using protocol 2:
>>> from django.utils.datastructures import MultiValueDict
>>> d['a'] = 'b'
>>> pickle.loads(pickle.dumps(d, 2)) == d
False
>>> d
<MultiValueDict: {'a': ['b']}>
>>> pickle.loads(pickle.dumps(d, 2))
<MultiValueDict: {'a': [['b']]>
A zoom to the root of the problem:
>>> list(d.__reduce_ex__(2)[-1])
[('a', ['b'])]
Which is wrong. On CPython, it gives [('a', 'b')].
This is caused by not calling the custom itervalues() method of the
custom python class. The call which should be routed to the python
implementation is on PyObject#reduce_2(). The "routing" doesn't happen,
because PyDictDerived doesn't override itervalues().
Now, if we take the strategy of "routing" calls, I'm not sure how much
of the dict interface should we override on PyDictDerived to allow
forwarding java calls to the right place. All of it?
Another option would be to override __reduce__ on PyDictionaryDerived. |
|
Date |
User |
Action |
Args |
2009-02-02 02:39:58 | leosoto | set | recipients:
+ leosoto |
2009-02-02 02:39:57 | leosoto | set | messageid: <1233542397.93.0.472123912362.issue1257@psf.upfronthosting.co.za> |
2009-02-02 02:39:57 | leosoto | link | issue1257 messages |
2009-02-02 02:39:57 | leosoto | create | |
|