#12941: Cache should be cleared on cloning
-----------------------------+----------------------------------------------
Reporter: hivert | Owner: hivert
Type: defect | Status: new
Priority: major | Milestone: sage-5.1
Component: combinatorics | Keywords: Clone, cache, days38
Work issues: | Report Upstream: N/A
Reviewers: | Authors: Florent Hivert
Merged in: | Dependencies:
Stopgaps: |
-----------------------------+----------------------------------------------
With
{{{
class Foo(ClonableIntArray):
@cached_method
def sum(self):
return add(i for i in self)
def check(self):
pass
}}}
One gets:
{{{
sage: Foo(Parent(), [1,2,3])
[1, 2, 3]
sage: f = Foo(Parent(), [1,2,3])
sage: f.sum()
6
sage: with f.clone() as f1:
... f1[1] = 4
sage: f1
[1, 4, 3]
sage: f1.sum()
6
}}}
The last result should be {{{8}}}. This happens because the cache of sum
isn't
cleared for the cloned object {{{f1}}}
Florent
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12941>
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.