On Oct 16, 7:29 pm, Andrew Mathas <andrew.mat...@gmail.com> wrote:

> register_unpickle_override('sage.combinat.tableau', 'Tableau_class',
> Tableau)
>
> but this does not work. My guess is that it is not possible to unpickle the
> deprecated *Tableau_class* objects using the new *Tableau* class objects
> because the underlying classes are too different.
>
> If some one can see how to do this please let me know.

The mechanism of unpickling is probably that the arguments for the
call to Tableau_class required to reconstruct the desired instance are
first "unpickled" (by whatever means appropriate for their types and
then a call is made to Tableau_class with those arguments. I assume
that the unpickle_override just ensures that now Tableau gets called,
but with arguments identical to what Tableau used to get! If the
arguments required between Tableau_class and Tableau are not
compatible then this approach doesn't work.

What you probably need is

register_unpickle_override('sage.combinat.tableau', 'Tableau_class',
construct_Tableau_from_Tableau_class_data)

where construct_Tableau_from_Tableau_class_data is a function that
takes as arguments the same arguments that Tableau_class would take
and returns an instance of Tableau that is as close as possible to
whatever Tableau_class would otherwise have been produced.

This is how you provide an "upgrade path". I think there are more
complicated pickle/unpickle mechanisms than this (__getstate__ and
__setstate__ stuff), but I don't see how a
"register_unpickle_override" would be able to get in between there.

I guess to start with you could put a function in there that prints
all its arguments to get some idea what you have to interface with.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.


Reply via email to