Ticket #5059: trac-5059.patch

File trac-5059.patch, 3.3 KB (added by craigcitro, 14 years ago)
  • sage/categories/map.pyx

    # HG changeset patch
    # User Craig Citro <craigcitro@gmail.com>
    # Date 1232668475 28800
    # Node ID 1fb8b9e07a50fb021706d1690983dd177059e008
    # Parent  f8fb0bf3e547d65a0f90f5b27d543c8cf4ca9da0
    Fix trac #5059 -- fix unpickling of old modular symbols spaces.
    
    diff -r f8fb0bf3e547 -r 1fb8b9e07a50 sage/categories/map.pyx
    a b  
    5252    cdef _update_slots(self, _slots):
    5353        self._domain = _slots['_domain']
    5454        self._codomain = _slots['_codomain']
    55         self._repr_type_str = _slots['_repr_type_str']
     55        # Several pickles exist without a _repr_type_str, so
     56        # if there is none saved, we just set it to None.
     57        if _slots.has_key('_repr_type_str'):
     58            self._repr_type_str = _slots['_repr_type_str']
     59        else:
     60            self._repr_type_str = None
    5661
    5762    def _test_update_slots(self, _slots):
    5863        self._update_slots(_slots)
  • sage/modular/all.py

    diff -r f8fb0bf3e547 -r 1fb8b9e07a50 sage/modular/all.py
    a b  
    1010                       kronecker_character, kronecker_character_upside_down,
    1111                       trivial_character)
    1212
    13 from congroup import (Gamma0, Gamma1, GammaH, SL2Z,
     13from congroup import (Gamma0_constructor as Gamma0,
     14                      Gamma1_constructor as Gamma1,
     15                      GammaH_constructor as GammaH,
     16                      SL2Z,
    1417                      is_CongruenceSubgroup, is_Gamma0, is_Gamma1, is_GammaH, is_SL2Z)
    1518
    1619from cusps import Cusp, Cusps
  • sage/modular/congroup.py

    diff -r f8fb0bf3e547 -r 1fb8b9e07a50 sage/modular/congroup.py
    a b  
    603603
    604604
    605605_gammaH_cache = {}
    606 def GammaH(level, H):
     606def GammaH_constructor(level, H):
    607607    r"""
    608608    Return the congruence subgroup $\Gamma_H(N)$, which is the subgroup of
    609609    $SL_2(\Z)$ consisting of matrices of the form $\begin{pmatrix} a & b \\
     
    13641364    return isinstance(x, Gamma0_class)
    13651365
    13661366_gamma0_cache = {}
    1367 def Gamma0(N):
     1367def Gamma0_constructor(N):
    13681368    """
    13691369    Return the congruence subgroup Gamma0(N).
    13701370
     
    18481848    return (isinstance(x, Gamma1_class) or is_SL2Z(x))
    18491849
    18501850_gamma1_cache = {}
    1851 def Gamma1(N):
     1851def Gamma1_constructor(N):
    18521852    r"""
    18531853    Return the congruence subgroup $\Gamma_1(N)$.
    18541854
     
    20682068import congroup_pyx
    20692069degeneracy_coset_representatives_gamma0 = congroup_pyx.degeneracy_coset_representatives_gamma0
    20702070degeneracy_coset_representatives_gamma1 = congroup_pyx.degeneracy_coset_representatives_gamma1
     2071
     2072###########################################################
     2073# Re-bindings for unpickling
     2074#
     2075# Because we have a large number of pickles which were
     2076# created when Gamma0, Gamma1, etc., were still classes
     2077# as opposed to functions, we can't unpickle these unless
     2078# sage.modular.congroup.Gamma0, etc. are classes. So we
     2079# re-bind these as such below -- note that these bindings
     2080# are *DIFFERENT* than the bindings for Gamma0, etc. that
     2081# get imported in all.py.
     2082#
     2083# See trac #5059.
     2084#
     2085###########################################################
     2086
     2087Gamma0 = Gamma0_class
     2088Gamma1 = Gamma1_class
     2089GammaH = GammaH_class