Issue892902
Created on 2004-02-08 15:55 by tovrstra, last changed 2009-02-14 11:31 by ajaksu2.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
pickletest.py
|
tovrstra,
2004-02-08 15:55
|
pickletest.py |
|
|
|
msg19940 - (view) |
Author: Toon Verstraelen (tovrstra) |
Date: 2004-02-08 15:55 |
|
My python version:
Python 2.3.3 (#1, Jan 25 2004, 21:45:01)
[GCC 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r3,
propolice)] on linux2
Please try the example. That will explain a lot. The
problem is that not all new style class instances are
picklable. In my example a class is derived from a list
and a base class. The list-descendant contains an
instance of the base class, which has a reference to
the list containing it. with cPickle things work fine,
but not for the normal pickle routines
class subitem:
def __init__(self, parent):
self.parent = parent
if parent != None:
parent.append(self)
class group(subitem, list):
def __init__(self, parent):
subitem.__init__(self, parent)
g = group(None)
s = subitem(g)
import cPickle
print cPickle.dumps(g)
import pickle
print pickle.dumps(g)
|
|
msg19941 - (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2005-10-01 13:40 |
|
Logged In: YES
user_id=1188172
Verified in 2.5cvs.
|
|
msg58057 - (view) |
Author: Alexandre Vassalotti (alexandre.vassalotti) |
Date: 2007-12-01 17:35 |
|
Please assign this bug to me.
Note that neither cPickle or pickle is able to load the stream generated
by cPickle correctly:
>>> g = group(None)
>>> subitem(g)
>>> g[0].parent is g
True
>>> gp = cPickle.loads(cPickle.dumps(g))
>>> gp[0].parent is gp
False
I don't think that will be easy to fix, but I will try to see what I can do.
|
|
msg82010 - (view) |
Author: Daniel Diniz (ajaksu2) |
Date: 2009-02-14 11:31 |
|
Confirmed on trunk.
|
|
| Date |
User |
Action |
Args |
| 2009-02-14 11:31:46 | ajaksu2 | set | nosy:
+ ajaksu2 stage: test needed messages:
+ msg82010 versions:
+ Python 2.6, - Python 2.3 |
| 2007-12-01 18:00:25 | alexandre.vassalotti | set | assignee: alexandre.vassalotti |
| 2007-12-01 17:35:21 | alexandre.vassalotti | set | nosy:
+ alexandre.vassalotti type: behavior messages:
+ msg58057 components:
+ Library (Lib), - Interpreter Core |
| 2004-02-08 15:55:57 | tovrstra | create | |
|