#11521: Memleak when resolving the action of Integers on an Elliptic Curve
------------------------+---------------------------------------------------
   Reporter:  jpflori   |          Owner:  robertwb   
       Type:  defect    |         Status:  needs_work 
   Priority:  major     |      Milestone:  sage-4.8   
  Component:  coercion  |       Keywords:  sd35       
Work_issues:            |       Upstream:  N/A        
   Reviewer:            |         Author:  Simon King 
     Merged:            |   Dependencies:  #11900 #715
------------------------+---------------------------------------------------

Comment(by SimonKing):

 Replying to [comment:100 jpflori]:
 > Anyway, it does not make much sense to me that the _action_hash dict in
 the Parent class uses "==" rather than "is", especially since the
 TripleDict of the coercion model do.

 The old `TripleDict` didn't - I changed that only in #715. Perhaps it is
 debatable whether that change is fine. But:

 > What do yo think? Have you any good reason to justify such a choice that
 I might have missed?

 See sage/structure/coerce.pyx:
 {{{
             if y_mor is not None:
                 all.append("Coercion on right operand via")
                 all.append(y_mor)
                 if res is not None and res is not y_mor.codomain():
                     raise RuntimeError, ("BUG in coercion model: codomains
 not equal!", x_mor, y_mor)
 }}}

 That is why I think one should test for identity, not equality.

 On the other hand, we also have
 {{{
         # Make sure the domains are correct
         if R_map.domain() is not R:
             if fix:
                 connecting = R_map.domain().coerce_map_from(R)
                 if connecting is not None:
                     R_map = R_map * connecting
             if R_map.domain() is not R:
                 raise RuntimeError, ("BUG in coercion model, left domain
 must be original parent", R, R_map)
         if S_map is not None and S_map.domain() is not S:
             if fix:
                 connecting = S_map.domain().coerce_map_from(S)
                 if connecting is not None:
                     S_map = S_map * connecting
             if S_map.domain() is not S:
                 raise RuntimeError, ("BUG in coercion model, right domain
 must be original parent", S, S_map)
 }}}
 in the same file. These lines apparently cope with the fact that there are
 non-unique parents, and they suggest that `==` is the right thing to do in
 the coerce caches.

 But I think this is a discussion that belongs to #715.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11521#comment:101>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to