# 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
|
|
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 |
… |
… |
|
222 | 230 | |
223 | 231 | try: |
224 | 232 | # 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 |
226 | 238 | except (AttributeError, TypeError): |
227 | 239 | pass |
228 | 240 | |