Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
) * remove improper usage of @cache on async functions (#67) * remove improper usage of @cache on async functions Neither functools.cache nor functools.lru_cache which was previously used here works properly with async functions. These decorators cache the coroutine, but coroutines can only be awaited once, so this falls apart. Take the following example: ``` In [1]: from functools import cache In [2]: @cache ...: async def abc(): ...: return 1234 ...: In [3]: print(await abc()) 1234 In [4]: print(await abc()) --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) Cell In[4], line 1 ----> 1 print(await abc()) RuntimeError: cannot reuse already awaited coroutine ``` * Fix changelog. --------- Co-authored-by: Felix Fontein <[email protected]> * update changelog entry --------- Co-authored-by: Felix Fontein <[email protected]>
- Loading branch information