Skip to content

Commit

Permalink
GH-93179: Document the thread safety of functools.lru_cache (GH-95970)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhettinger authored Aug 18, 2022
1 parent 214eb2c commit ba4bb7e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Doc/library/functools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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.

Expand Down

0 comments on commit ba4bb7e

Please sign in to comment.