Ticket #13184: trac_13184_sage_5.5.0.beta.patch

File trac_13184_sage_5.5.0.beta.patch, 1.6 KB (added by caruso, 7 years ago)
  • sage/categories/homset.py

    # HG changeset patch
    # User Xavier Caruso <xavier.caruso@normalesup.org>
    # Date 1341738209 -7200
    # Node ID 059a3d1ed922b07d14220a897487f100ac8e4a70
    # Parent  63f47e1ba4934889f123e13a4471e2719431fbb3
    Trac #13184: Unique parent assumption for homset
    
    diff --git a/sage/categories/homset.py b/sage/categories/homset.py
    a b  
    154154
    155155    TESTS:
    156156
    157     Some doc tests in :mod:`sage.rings` (need to) break the unique parent assumption.
    158     But if domain or codomain are not unique parents, then the hom set won't fit.
    159     That's to say, the hom set found in the cache will have a (co)domain that is
     157    Homset are unique parents::
     158
     159        sage: k = GF(5)
     160        sage: H1 = Hom(k,k)
     161        sage: H2 = Hom(k,k)
     162        sage: H1 is H2
     163        True
     164
     165    However, some doc tests in :mod:`sage.rings` (need to) break the unique parent
     166    assumption. If domain or codomain are not unique parents, then the hom set won't
     167    fit. That's to say, the hom set found in the cache will have a (co)domain that is
    160168    equal to, but not identic with, the given (co)domain.
    161169
    162170    By trac ticket #9138, we abandon the uniqueness of hom sets, if the domain or
     
    222230
    223231    try:
    224232        # Apparently X._Hom_ is supposed to be cached
    225         return X._Hom_(Y, category)
     233        # but it is not in some cases (e.g. X is a finite field)
     234        # To be investigated
     235        H = X._Hom_(Y,category)
     236        _cache[key] = weakref.ref(H)
     237        return H
    226238    except (AttributeError, TypeError):
    227239        pass
    228240