copying cached_methods does not work properly
A few funny things can happen when copying cached methods:
sage: class A:
... @cached_method
... def f(self):
... return 1
...
sage: class B:
... g=A.f
... def f(self):
... return 2
...
...
sage: b=B()
sage: b.f()
2
sage: b.g()
1
sage: b.f()
1
The problem is that a call to b.g leads to a new MethodCaller? in b.f; something similar happens here:
sage: class C:
... g=A.f
...
sage: c=C()
sage: c.g is c.g
False
sage: c.g is c.f
True
Change History (17)
Type: 
PLEASE CHANGE →
defect

Milestone: 
sage5.11 →
sage5.12

Milestone: 
sage6.1 →
sage6.2

Milestone: 
sage6.2 →
sage6.3

Milestone: 
sage6.3 →
sage6.4

Branch: 
→ u/saraedum/copying_cached_methods_does_not_work_properly

Authors: 
→ Julian Rüth

Commit: 
→ d85263804f48b54e9869914c9a96f9c42253eb9e

Status: 
new →
needs_review

Status: 
needs_review →
needs_work

Commit: 
d85263804f48b54e9869914c9a96f9c42253eb9e →
90147cae0db60208896a36e2ac3d87c8c2027c63

Status: 
needs_work →
needs_review

Keywords: 
days71 added

Status: 
needs_review →
positive_review

Status: 
positive_review →
needs_work

Reviewers: 
→ David Roe

Status: 
needs_work →
positive_review

Reviewers: 
David Roe →
David Roe, Aly Deines

Branch: 
u/saraedum/copying_cached_methods_does_not_work_properly →
90147cae0db60208896a36e2ac3d87c8c2027c63

Resolution: 
→ fixed

Status: 
positive_review →
closed

Is that a new bug (i.e., introduced by my code from #11115)?
Anyway, it is not clear to me how the problem could be solved. Namely, a cached method knows the name under which it was defined, but if one assigns it to a different name afterwards, I see no way for the cached method to find out that new name.