#5843: race condition in cached_method (should not be shared between instances)
---------------------------------+------------------------------------------
Reporter: nthiery | Owner: mhansen
Type: defect | Status: needs_work
Priority: critical | Milestone: sage-4.3.1
Component: misc | Keywords: race condition, cached_method,
cache
Author: Willem Palenstijn | Upstream: N/A
Reviewer: Tim Dumol | Merged:
Work_issues: |
---------------------------------+------------------------------------------
Changes (by newvalueoldvalue):
* status: needs_review => needs_work
* reviewer: => Tim Dumol
* author: => Willem Palenstijn
Comment:
Excellent patch (I couldn't figure out how to fix this, glad you did), but
there doesn't seem to be a test for the main problem:
{{{
class bla:
def __init__(self, value):
self.value = value
#
@cached_method
def f(self, x):
return self.value
}}}
The method f ignores its input, and should return self.value:
{{{
sage: x = bla(1)
sage: y = bla(2)
sage: x.f(None)
1
sage: y.f(None)
2
}}}
Then, y.f(x.f) should ignore the inner x.f and return 2. It does not:
{{{
sage: sage: y.f(x.f)
1
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5843#comment:3>
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.