On Sunday, April 6, 2014 1:35:17 PM UTC-7, Nathann Cohen wrote: > > No, I meant... Can't we add some parameter to cached_method, so that > it could not be applied to an object which inherits from > UniqueRepresentation (if this is the problem) ? > > something like > > def cached_method(self, function, > check_that_self_if_not_unique_representation=True): > if check_that_self_if_not_unique_representation and > isinstance(self,UniqueRepresentation): > raise RuntimeError("This will cause memory leaks ! If you know > what you are doing, disable this test") >
It's not "self" that matters, it's the result returned by the cached method that shouldn't contain any UniqueRepresentation object that was constructed using self. That's expensive to check. As a debugging tool, one could rig cached_method to do a check like that, though. It would involve a reverse lookup of construction parameters for all UniqueRepresentation objects found in the return value. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.