Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

key parameter of cached_method is not correctly propagated #16337

Closed
saraedum opened this issue May 12, 2014 · 8 comments
Closed

key parameter of cached_method is not correctly propagated #16337

saraedum opened this issue May 12, 2014 · 8 comments

Comments

@saraedum
Copy link
Member

In the following example, the last line is incorrect:

sage: class Foo:
....:     @cached_method(key=lambda self,y: y+1)
....:     def f(self, y):
....:         return y - 1
sage: class Bar:
....:     f = Foo.f

sage: b = Bar()
sage: b.f(0)
-1
sage: b.f.cache
{((0,), ()): -1}

It appears that I forgot to propagate the key parameter in some places while working on #15657.

Component: misc

Author: Julian Rueth

Branch/Commit: e27e316

Reviewer: Simon King

Issue created by migration from https://trac.sagemath.org/ticket/16337

@saraedum saraedum added this to the sage-6.3 milestone May 12, 2014
@saraedum
Copy link
Member Author

Branch: u/saraedum/ticket/16337

@saraedum

This comment has been minimized.

@saraedum
Copy link
Member Author

Author: Julian Rueth

@simon-king-jena
Copy link
Member

Commit: e27e316

@simon-king-jena
Copy link
Member

comment:3

The changes look good to me (and, by the way, I have not been aware that we now have a key parameter for cached methods). So, it will be a positive review, provided that the tests pass (which I am running now).


New commits:

e27e316Propagate key of a @cached_method correctly

@simon-king-jena
Copy link
Member

comment:4

Tests pass, hence, positive review as announced!

@simon-king-jena
Copy link
Member

Reviewer: Simon King

@vbraun
Copy link
Member

vbraun commented May 15, 2014

Changed branch from u/saraedum/ticket/16337 to e27e316

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants