Opened 7 years ago

Closed 7 years ago

#16337 closed defect (fixed)

key parameter of cached_method is not correctly propagated

Reported by: saraedum Owned by:
Priority: minor Milestone: sage-6.3
Component: misc Keywords:
Cc: Merged in:
Authors: Julian Rueth Reviewers: Simon King
Report Upstream: N/A Work issues:
Branch: e27e316 (Commits, GitHub, GitLab) Commit: e27e3167dde69107bb4f4c296c33b5827e70d4da
Dependencies: Stopgaps:

Status badges

Description (last modified by saraedum)

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)
sage: b.f.cache
{((0,), ()): -1}

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

Change History (5)

comment:1 Changed 7 years ago by saraedum

  • Branch set to u/saraedum/ticket/16337
  • Created changed from 05/12/14 16:59:00 to 05/12/14 16:59:00
  • Modified changed from 05/12/14 16:59:00 to 05/12/14 16:59:00

comment:2 Changed 7 years ago by saraedum

  • Authors set to Julian Rueth
  • Description modified (diff)
  • Status changed from new to needs_review

comment:3 Changed 7 years ago by SimonKing

  • Commit set to e27e3167dde69107bb4f4c296c33b5827e70d4da

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

comment:4 Changed 7 years ago by SimonKing

  • Reviewers set to Simon King
  • Status changed from needs_review to positive_review

Tests pass, hence, positive review as announced!

comment:5 Changed 7 years ago by vbraun

  • Branch changed from u/saraedum/ticket/16337 to e27e3167dde69107bb4f4c296c33b5827e70d4da
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.