This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients gvanrossum, josh.r, levkivskyi, ned.deily, serhiy.storchaka, yselivanov
Date 2016-11-09.19:06:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> 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:31yselivanovsetrecipients: + yselivanov, gvanrossum, ned.deily, serhiy.storchaka, josh.r, levkivskyi
2016-11-09 19:06:31yselivanovsetmessageid: <>
2016-11-09 19:06:31yselivanovlinkissue28649 messages
2016-11-09 19:06:31yselivanovcreate