summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-12-24 20:25:34 (GMT)
committerGitHub <noreply@github.com>2022-12-24 20:25:34 (GMT)
commit3b704874592a3a1895c9a69a39c23ea22d1d06ca (patch)
tree856c8b1e5fe8288dd03c3bb90fca9e45b251f579
parentbf0f306bcd4cc6ebe7dcb32c79dd1aba0b910804 (diff)
downloadcpython-3b704874592a3a1895c9a69a39c23ea22d1d06ca.zip
cpython-3b704874592a3a1895c9a69a39c23ea22d1d06ca.tar.gz
cpython-3b704874592a3a1895c9a69a39c23ea22d1d06ca.tar.bz2
GH-93179: Document the thread safety of functools.lru_cache (GH-95970)
(cherry picked from commit ba4bb7e4649be99d5d6b4151a1bd2eac89ef97f2) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
-rw-r--r--Doc/library/functools.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index 9beebd2..2f0a9bd 100644
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -49,6 +49,9 @@ The :mod:`functools` module defines the following functions:
>>> factorial(12) # makes two new recursive calls, the other 10 are cached
479001600
+ The cache is threadsafe so the wrapped function can be used in multiple
+ threads.
+
.. versionadded:: 3.9
@@ -140,6 +143,9 @@ The :mod:`functools` module defines the following functions:
*maxsize* most recent calls. It can save time when an expensive or I/O bound
function is periodically called with the same arguments.
+ The cache is threadsafe so the wrapped function can be used in multiple
+ threads.
+
Since a dictionary is used to cache results, the positional and keyword
arguments to the function must be hashable.