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 jaraco
Recipients jaraco, rhettinger
Date 2014-08-11.19:53:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In, a user was confused when he tried to use the lrucache decorator incorrectly, passing the wrapped function directly to lrucache. Consider:

    def expensive(param):

One can even get away with profiling that now decorated function:

    for x in range(10000):

The test will run without error, but it's not doing what the user thinks it's doing. In the first section, it's creating a decorator, and in the second section, it's wrapping an int in that decorator, but because the wrapper is never called, an error is never raised.

I propose adding a simple check that if maxsize is callable, raise a TypeError. That would prevent unintentional misuse and subtle non-failure with minimal impact on performance.
Date User Action Args
2014-08-11 19:53:01jaracosetrecipients: + jaraco, rhettinger
2014-08-11 19:53:01jaracosetmessageid: <>
2014-08-11 19:53:01jaracolinkissue22184 messages
2014-08-11 19:53:01jaracocreate