# HG changeset patch
# User Xavier Caruso <xavier.caruso@normalesup.org>
# Date 1341738209 7200
# Node ID 09ba9b7f74b31e781e40c0f2bbe765e6c9c7bdb2
# Parent c4bdbf18dd78c13ff3032e07a3f355b8632ac054
Trac #13184: Unique parent assumption for homset
diff git a/sage/categories/homset.py b/sage/categories/homset.py
a

b


154  154  
155  155  TESTS: 
156  156  
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 
160  168  equal to, but not identic with, the given (co)domain. 
161  169  
162  170  By trac ticket #9138, we abandon the uniqueness of hom sets, if the domain or 
… 
… 

221  229  return H 
222  230  
223  231  try: 
224   # Apparently X._Hom_ is supposed to be cached 
225   return X._Hom_(Y, category) 
 232  # Actually X._Hom_ is supposed to be cached 
 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 
226  238  except (AttributeError, TypeError): 
227  239  pass 
228  240  