#14471: Category refinement sometimes changes the hash of parents
--------------------------------+-------------------------------------------
       Reporter:  vbraun        |         Owner:  rlm       
           Type:  defect        |        Status:  needs_work
       Priority:  critical      |     Milestone:  sage-5.11 
      Component:  memleak       |    Resolution:            
       Keywords:                |   Work issues:            
Report Upstream:  N/A           |     Reviewers:  Simon King
        Authors:  Volker Braun  |     Merged in:            
   Dependencies:                |      Stopgaps:            
--------------------------------+-------------------------------------------
Changes (by SimonKing):

  * status:  needs_review => needs_work


Comment:

 There is no regression in startup time. However, I did not succeed to get
 the warning when changing the hash. I tried:
 {{{
         Here is a test against :trac:`14471`. Refining the category will
 issue
         a warning, if this change affects the hash value (note that this
 will
         only be seen in doctest mode)::

             sage: class MyParent(Parent):
             ....:     def __hash__(self):
             ....:         return hash(type(self))
             ....:
             sage: a = MyParent(category=Rings())
             sage: h = hash(a)
             sage: a._refine_category_(Algebras(QQ))
             hash of <class '__main__.MyParent_with_category'> changed in
 Parent._refine_category_
             sage: h == hash(a)
             False
 }}}

 If I understand correctly, the check of refine category will by default be
 done in doctests. But I get:
 {{{
 Failed example:
     a._refine_category_(Algebras(QQ))
 Expected:
     hash of <class '__main__.MyParent_with_category'> changed in
 Parent._refine_category_
 Got:
     <BLANKLINE>
 }}}

 So, what shall one do?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14471#comment:30>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to