Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the thread safety of functools.lru_cache #93179

Closed
pfmoore opened this issue May 24, 2022 · 0 comments
Closed

Document the thread safety of functools.lru_cache #93179

pfmoore opened this issue May 24, 2022 · 0 comments
Assignees
Labels
docs Documentation in the Doc dir

Comments

@pfmoore
Copy link
Member

pfmoore commented May 24, 2022

Documentation

The documentation doesn't state whether functools.lru_cache (and decorators derived from it like functools.cache) are thread safe, meaning that it's not clear that it's safe to (for example) populate the cache by running the function in multiple threads. The comments in the source code certainly imply that it's intended to be thread safe, but I'll admit I haven't double checked all the details.

Can the thread safety be made explicit in the docs?

Linked PRs

@pfmoore pfmoore added the docs Documentation in the Doc dir label May 24, 2022
@rhettinger rhettinger self-assigned this May 25, 2022
rhettinger added a commit to rhettinger/cpython that referenced this issue Aug 13, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 24, 2022
…thonGH-95970)

(cherry picked from commit ba4bb7e)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
miss-islington added a commit that referenced this issue Dec 24, 2022
(cherry picked from commit ba4bb7e)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants