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

functools.lru_cache prevents function being cached from executing concurrently under free-threading #131757

Open
tom-pytel opened this issue Mar 26, 2025 · 0 comments
Labels
topic-free-threading type-feature A feature request or enhancement

Comments

@tom-pytel
Copy link
Contributor

tom-pytel commented Mar 26, 2025

Feature or enhancement

Proposal:

functools.lru_cache was made free-thread safe but is not so in an efficient way. It works currently by serializing the function being cached and preventing it from executing concurrently even if it can. Effectively, for the function being cached, it is as if the GIL still exists.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-free-threading type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants