Skip to content

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

Closed
@tom-pytel

Description

@tom-pytel

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions