Pickling C extension types

Graeme Winter g.winter at dl.ac.uk
Mon Mar 31 04:54:51 EST 2003


Hello All,

Is there an example anywhere of an extension type to Python being 
pickled? I want to define an object type in C, but have it pickle-able.

If I just try pickling, I get:

 >>> pickle.dumps(n)
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/usr/lib/python2.2/pickle.py", line 977, in dumps
     Pickler(file, bin).dump(object)
   File "/usr/lib/python2.2/pickle.py", line 115, in dump
     self.save(object)
   File "/usr/lib/python2.2/pickle.py", line 185, in save
     raise PicklingError, \
pickle.PicklingError: can't pickle 'Noddy' object: <Noddy object at 
0x8118ee0>
 >>>

Any help would be greatly appreciated.

Cheers,

Graeme





More information about the Python-list mailing list