[Python-checkins] GH-93179: Document the thread safety of functools.lru_cache (GH-95970)

rhettinger webhook-mailer at python.org
Thu Aug 18 18:38:57 EDT 2022


https://github.com/python/cpython/commit/ba4bb7e4649be99d5d6b4151a1bd2eac89ef97f2
commit: ba4bb7e4649be99d5d6b4151a1bd2eac89ef97f2
branch: main
author: Raymond Hettinger <rhettinger at users.noreply.github.com>
committer: rhettinger <rhettinger at users.noreply.github.com>
date: 2022-08-18T17:38:49-05:00
summary:

GH-93179: Document the thread safety of functools.lru_cache (GH-95970)

files:
M Doc/library/functools.rst

diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index 00aca09bc7a..47cbe59fa49 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.
 



More information about the Python-checkins mailing list