Issue1007
Created on 2008-03-11.13:23:21 by PBlitz, last changed 2009-06-21.22:00:47 by pjenvey.
msg3083 (view) |
Author: (PBlitz) |
Date: 2008-03-11.13:23:20 |
|
Pickling of a class derived from dict creates an empty pickle in jython
2.2.1. In contrast Python 2.5.2 delivers the expected result.
I dont know how to solve the problem.
# code:
from __future__ import generators
class MyDict(dict):
def __init__(self, d = None):
if d == None: d = {}
dict.__init__(d)
if __name__ == "__main__":
import pickle
dd = MyDict()
dd['z'] = [0,1]
dd['b'] = [2,3]
p = pickle.dumps(dd)
print "-> pickle p:\n", p
u = pickle.loads(p)
print "-> MyDict dd:\n", dd
print "-> reconstructed MyDict u:\n", u
# jython 2.2.1 output with empty pickle p:
-> pickle p:
c__main__
MyDict
p0
(tp1
Rp2
.
-> MyDict dd:
{'b': [2, 3], 'z': [0, 1]}
-> reconstructed MyDict u:
{}
# in contrast python 2.5.2 output with filled pickle p:
-> pickle p:
ccopy_reg
_reconstructor
p0
(c__main__
MyDict
p1
c__builtin__
dict
p2
(dp3
S'z'
p4
(lp5
I0
aI1
asS'b'
p6
(lp7
I2
aI3
astp8
Rp9
.
-> MyDict dd:
{'z': [0, 1], 'b': [2, 3]}
-> reconstructed MyDict u:
{'z': [0, 1], 'b': [2, 3]}
|
msg3091 (view) |
Author: John Sirbu (john.jython) |
Date: 2008-03-17.20:39:51 |
|
Trunk in development has the appropriate and associated fix.
Just a heads up, hash/key order can vary across platforms and jvms.
|
msg3948 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2008-12-17.15:01:04 |
|
Works in 2.5, but we probably want to look at this for 2.2.2.
|
msg4838 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2009-06-21.22:00:47 |
|
fixed in 2.5
|
|
Date |
User |
Action |
Args |
2009-06-21 22:00:47 | pjenvey | set | status: open -> closed resolution: fixed messages:
+ msg4838 nosy:
+ pjenvey |
2009-03-14 03:13:05 | fwierzbicki | set | versions:
+ 2.2.2, - 2.2rc3 |
2008-12-17 15:01:04 | fwierzbicki | set | priority: low messages:
+ msg3948 |
2008-03-17 20:39:52 | john.jython | set | nosy:
+ john.jython messages:
+ msg3091 |
2008-03-11 18:24:21 | fwierzbicki | set | nosy:
+ fwierzbicki |
2008-03-11 13:31:48 | PBlitz | set | title: pickling of a class derived from dict is empty -> pickling of a class derived from dict delivers only empty dicts |
2008-03-11 13:23:21 | PBlitz | create | |
|