# HG changeset patch
# User Nicolas M. Thiery <nthiery@users.sf.net>
# Date 1369362274 14400
# Node ID 0bcd6cdb3fb0d7be672be0856c90e55da73dc635
# Parent e9a30b353572a8b82c7589fdade1b1c239c9bbfb
#12876: Fix element and parent classes of Hom categories to be abstract, and simplify the Hom logic
diff git a/sage/categories/schemes.py b/sage/categories/schemes.py
a

b

class Schemes_abstract(Category): 
148  148  """ 
149  149  return [] 
150  150  
151   class ParentMethods: 
152   
153   def __new__(cls, R, S, category): 
154   """ 
155   TESTS:: 
156   
157   sage: E = EllipticCurve('37a1') 
158   sage: Hom(E, E).__class__ 
159   <class 'sage.schemes.generic.homset.SchemeHomset_generic_with_category'> 
160   
161   If both schemes R and S are actually specs, we want 
162   the parent for Hom(R, S) to be in a different class:: 
163   
164   sage: Hom(Spec(ZZ), Spec(ZZ)).__class__ 
165   <class 'sage.schemes.affine.affine_homset.SchemeHomset_points_spec_with_category'> 
166   
167   Currently, and to minimize the changes, this is done 
168   by delegating the job to SchemeHomset. This is not 
169   very robust: for example, only one category can do 
170   this hack. 
171   
172   FIXME: this might be better handled by an extra Spec category 
173   """ 
174   from sage.schemes.generic.homset import SchemeHomset 
175   return SchemeHomset(R, S, category=category) 
176  151  
177  152  
178  153  ############################################################# 
diff git a/sage/schemes/generic/scheme.py b/sage/schemes/generic/scheme.py
a

b

class Scheme(Parent): 
658  658  sage: S = Spec(ZZ) 
659  659  sage: S._Hom_(P) 
660  660  Set of rational points of Projective Space of dimension 3 over Integer Ring 
 661  
 662  TESTS:: 
 663  
 664  sage: S._Hom_(P).__class__ 
 665  <class 'sage.schemes.projective.projective_homset.SchemeHomset_points_projective_ring_with_category'> 
 666  
 667  sage: E = EllipticCurve('37a1') 
 668  sage: Hom(E, E).__class__ 
 669  <class 'sage.schemes.generic.homset.SchemeHomset_generic_with_category'> 
 670  
 671  sage: Hom(Spec(ZZ), Spec(ZZ)).__class__ 
 672  <class 'sage.schemes.affine.affine_homset.SchemeHomset_points_spec_with_category'> 
661  673  """ 
662  674  from sage.schemes.generic.homset import SchemeHomset 
663  675  return SchemeHomset(self, Y, category=category, check=check) 