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] provide an async-compatible version of functools.lru_cache #79221
Comments
lru_cache is a very useful method but it does not work well with coroutines since they can only be executed once. Take for example, the attached code (test-case.py) - It will throw a RuntimeError because you cannot reuse an already awaited coroutine. A solution would be to call |
A coroutine detection is a relatively slow check. There is a specialized asyncio compatible version: https://github.com/aio-libs/async_lru |
Making this a feature request. |
Brett please elaborate. |
I was just saying that this is an enhancement request, no judgment about whether we want to solve the enhancement request. |
Wouldn't a coroutine check only happen during decoration time? To successfully solve this easily and efficiently, we only really need to wrap the coroutine with Of course, I don't know much about the internals of |
Duplicate of #90780 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: