[Numpy-discussion] Deserialization uncouples shared arrays
Tue Sep 22 07:28:01 CDT 2009
On Tuesday 22 September 2009 13:14:55 Hrvoje Niksic wrote:
> Hans Meine wrote:
> > On Tuesday 22 September 2009 11:01:37 Hrvoje Niksic wrote:
> >> Is it intended for deserialization to uncouple arrays that share a
> >> common base?
> > I think it's not really intended, but it's a limitation by design.
> I wonder why a "base" attribute is even restored, then?
Oh, is it? Don't know if that makes sense, then.
> If there is no
> care to restore the shared views, then views could simply be serialized
> as arrays?
After your posting, I thought they were..
> > AFAIK, it's related to Luca Citi's recent "ultimate base" thread - you
> > simply cannot ensure serialization of arbitrary ndarrays in this way,
> > because they may point to *any* memory, not necessarily an
> > ndarray-allocated one.
> That's true in general. I wonder if it's possible to restore shared
> arrays if (by virtue of "base" attribute) we know that the ndarray
> shares the memory of another ndarray.
For this special case, it looks possible (although slightly dangerous) to me.
It's also a common special case, so maybe you should open a ticket?
More information about the NumPy-Discussion