Ticket #9265: trac_9265--tableaux_categories_pickles-am.patch

File trac_9265--tableaux_categories_pickles-am.patch, 3.9 KB (added by Andrew Mathas, 10 years ago)

Fixing a typo in a comment

  • sage/combinat/skew_tableau.py

    # HG changeset patch
    # User "sage-combinat script"
    # Date 1350477282 -39600
    # Node ID 1b874c7df202150c01890fd78649080f66b35cbe
    # Parent  7c493169450144ac07813d762f4c56e0abb87262
    Fixing outdated pickles caused by deprecation of old class names
    
    diff --git a/sage/combinat/skew_tableau.py b/sage/combinat/skew_tableau.py
    a b def StandardSkewTableaux_n(*args, **karg 
    12261226    deprecation(9265,'this class is deprecated. Use StandardSkewTableaux_size instead')
    12271227    return StandardSkewTableaux(*args, **kargs)
    12281228
    1229 
    1230 
     1229# October 2012: fixing outdated pickles which use the classes being deprecated
     1230from sage.structure.sage_object import register_unpickle_override
     1231register_unpickle_override('sage.combinat.skew_tableau', 'StandardSkewTableaux_n',  StandardSkewTableaux_size)
     1232register_unpickle_override('sage.combinat.skew_tableau', 'SemistandardSkewTableaux_n',  SemistandardSkewTableaux_size)
     1233register_unpickle_override('sage.combinat.skew_tableau', 'SemistandardSkewTableaux_nmu',  SemistandardSkewTableaux_size_weight)
     1234register_unpickle_override('sage.combinat.skew_tableau', 'SemistandardSkewTableaux_p',  SemistandardSkewTableaux_shape)
     1235register_unpickle_override('sage.combinat.skew_tableau', 'SemistandardSkewTableaux_pmu',  SemistandardSkewTableaux_shape_weight)
  • sage/combinat/tableau.py

    diff --git a/sage/combinat/tableau.py b/sage/combinat/tableau.py
    a b class Tableau(CombinatorialObject, Eleme 
    207207        if not map(len,t) in sage.combinat.partition.Partitions_all():
    208208            raise ValueError, "A tableau must be a list of lists of weakly decreasing length."
    209209
     210    def __setstate__(self, state):
     211        """
     212        In order to maintain backwards compatibility and be able to unpickle a
     213        old pickle from Tableau_class we have to override the default
     214        __setstate__.
     215
     216        TESTS::
     217
     218            sage: loads('x\x9ck`J.NLO\xd5K\xce\xcfM\xca\xccK,\xd1+IL\xcaIM,\xe5\n\x81\xd0\xf1\xc99\x89\xc5\xc5\\\x85\x8c\x9a\x8d\x85L\xb5\x85\xcc\x1a\xa1\xac\xf1\x19\x89\xc5\x19\x85,~@VNfqI!kl![l!;\xc4\x9c\xa2\xcc\xbc\xf4b\xbd\xcc\xbc\x92\xd4\xf4\xd4"\xae\xdc\xc4\xec\xd4x\x18\xa7\x90#\x94\xd1\xb05\xa8\x9031\xb14I\x0f\x00\xf6\xae)7')        # indirect doctest for unpickling a Tableau_class element
     219            [[1]]
     220            sage: loads(dumps( Tableau([[1]]) ))  # indirect doctest for unpickling a Tableau element
     221            [[1]]
     222        """
     223        if isinstance(state, dict):   # for old pickles from Tableau_class
     224            self._set_parent(Tableaux())
     225            self.__dict__ = state
     226        else:
     227            self._set_parent(state[0])
     228            self.__dict__ = state[1]
    210229
    211230    def _latex_(self):
    212231        r"""
    def StandardTableaux_partition(*args, ** 
    42644283    deprecation(9265,'this class is deprecated. Use StandardTableaux_shape instead')
    42654284    return StandardTableaux(*args, **kargs)
    42664285
    4267 
     4286# October 2012: fixing outdated pickles which use classed being deprecated
     4287from sage.structure.sage_object import register_unpickle_override
     4288register_unpickle_override('sage.combinat.tableau', 'Tableau_class',  Tableau)
     4289register_unpickle_override('sage.combinat.tableau', 'Tableaux_n',  Tableaux_size)
     4290register_unpickle_override('sage.combinat.tableau', 'StandardTableaux_n',  StandardTableaux_size)
     4291register_unpickle_override('sage.combinat.tableau', 'StandardTableaux_partition',  StandardTableaux_shape)
     4292register_unpickle_override('sage.combinat.tableau', 'SemistandardTableaux_n',  SemistandardTableaux_size)
     4293register_unpickle_override('sage.combinat.tableau', 'SemistandardTableaux_p',  SemistandardTableaux_shape)
     4294register_unpickle_override('sage.combinat.tableau', 'SemistandardTableaux_nmu',  SemistandardTableaux_size_weight)
     4295register_unpickle_override('sage.combinat.tableau', 'SemistandardTableaux_pmu',  SemistandardTableaux_shape_weight)
     4296
     4297