[Matrix-SIG] problems pickling arrays of PyObjects

Konrad Hinsen hinsen@cnrs-orleans.fr
Fri, 23 Oct 1998 19:04:53 +0200


>     I think I've found a fairly serious problem with Numeric's pickler:
> when you try to use it on arrays of arbitrary objects, it sometimes will
> cause a core dump either upon unpickling or upon access to the array
> after unpickling.

Now that I understand what the problem really is, the explanation is
fairly simple: There is no provision to pickle general-object arrays
at all in the current NumPy code, as is obvious from a quick glance at
module Numeric. The pickled file contains simply the addresses of the
elements.

Array pickling needs a serious revision anyway (with cPickle support),
so maybe this is a good opportunity to attack that problem. Maybe the
easiest solution for general-object arrays is conversion to a nested
list before pickling and reconversion upon loading. But an explicit
pickle routine for this case is not difficult either.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------