diff options
author | Manjusaka <me@manjusaka.me> | 2019-11-12 15:30:18 +0800 |
---|---|---|
committer | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-11-11 23:30:18 -0800 |
commit | 051ff526b5dc2c40c4a53d87089740358822edfa (patch) | |
tree | 3672f1a8ca53bfb008d3f56d2b8c5f29a04e3f6b /Lib/functools.py | |
parent | 98480cef9dba04794bd61c7e7cca643d384c8c35 (diff) | |
download | cpython-051ff526b5dc2c40c4a53d87089740358822edfa.tar.gz cpython-051ff526b5dc2c40c4a53d87089740358822edfa.zip |
bpo-38565: add new cache_parameters method for lru_cache (GH-16916)
Diffstat (limited to 'Lib/functools.py')
-rw-r--r-- | Lib/functools.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/functools.py b/Lib/functools.py index 3192bd02d93..2c01b2e5952 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -499,6 +499,7 @@ def lru_cache(maxsize=128, typed=False): # The user_function was passed in directly via the maxsize argument user_function, maxsize = maxsize, 128 wrapper = _lru_cache_wrapper(user_function, maxsize, typed, _CacheInfo) + wrapper.cache_parameters = lambda : {'maxsize': maxsize, 'typed': typed} return update_wrapper(wrapper, user_function) elif maxsize is not None: raise TypeError( @@ -506,6 +507,7 @@ def lru_cache(maxsize=128, typed=False): def decorating_function(user_function): wrapper = _lru_cache_wrapper(user_function, maxsize, typed, _CacheInfo) + wrapper.cache_parameters = lambda : {'maxsize': maxsize, 'typed': typed} return update_wrapper(wrapper, user_function) return decorating_function |