Message280437
> Good sleuthing! So the bug is in _lru_cache?
I don't think it's a bug of lru_cache. It stores strong references for arguments and return value of the decorated function (which btw isn't documented). I don't think it's possible to write efficient generic lru_cache that would just use weakrefs.
The problem is that because _tp_cache helper uses it, the lifetime of some typing classes becomes indefinite. Which shouldn't be a problem for a typical user of typing, since most of the time it is used on the module level.
We have two potential solutions to this problem:
1. Add a weak-ref type cache and refactor _tp_cache to use it;
2. Cleanup lru-cache before/adter running each typing test.
[1] is the ideal solution, [2] should work good enough. |
|
Date |
User |
Action |
Args |
2016-11-09 19:06:31 | yselivanov | set | recipients:
+ yselivanov, gvanrossum, ned.deily, serhiy.storchaka, josh.r, levkivskyi |
2016-11-09 19:06:31 | yselivanov | set | messageid: <1478718391.32.0.326880949325.issue28649@psf.upfronthosting.co.za> |
2016-11-09 19:06:31 | yselivanov | link | issue28649 messages |
2016-11-09 19:06:31 | yselivanov | create | |
|