Message3083
| Author | PBlitz |
|---|---|
| Recipients | PBlitz |
| Date | 2008年03月11日.13:23:20 |
| SpamBayes Score | 0.0 |
| Marked as misclassified | No |
| Message-id | <1205241801.36.0.931058940995.issue1007@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
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]} |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008年09月12日 00:29:57 | nriley | set | spambayes_score: 0.408577 -> 0.0 |
| 2008年03月11日 13:23:21 | PBlitz | set | spambayes_score: 0.408577 -> 0.408577 recipients: + PBlitz |
| 2008年03月11日 13:23:21 | PBlitz | set | spambayes_score: 0.408577 -> 0.408577 messageid: <1205241801.36.0.931058940995.issue1007@psf.upfronthosting.co.za> |
| 2008年03月11日 13:23:21 | PBlitz | link | issue1007 messages |
| 2008年03月11日 13:23:20 | PBlitz | create | |
Supported by Python Software Foundation,
Powered by Roundup