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 Scott Sanderson2
Recipients Scott Sanderson2
Date 2019-10-23.14:50:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In some circumstances, it's useful to be able in inspect the parameters with which an instance of functools.lru_cache was instantiated. It's currently possible to recover the cache's maxsize via the .cache_info() method, but there's no way to recover the value passed for `typed`, which controls whether the lru_cache's cache is partitioned by input type.

This came up in the context of cloudpickle, a library that tries to extend pickle to support more types (in particular, interactively-defined functions and classes) for use-cases like cluster computing. 

It's currently not possible to pickle an lru-cache decorated function that's defined in __main__ (which includes, e.g. a Jupyter Notebook). We can **almost** fix this with a pure library solution (see, but we're currently blocked by the fact that there's no way to recover the value that was passed for `typed`. Exposing a .typed attribute on the extension type for lru_cached functions fixes this

For more discussion, see the above linked PR, along with
Date User Action Args
2019-10-23 14:50:54Scott Sanderson2setrecipients: + Scott Sanderson2
2019-10-23 14:50:54Scott Sanderson2setmessageid: <>
2019-10-23 14:50:54Scott Sanderson2linkissue38565 messages
2019-10-23 14:50:54Scott Sanderson2create