This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients asvetlov, rhettinger, serhiy.storchaka, uranusjr, yselivanov
Date 2022-02-14.14:35:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Note that there is a similar issue with cached generators.

>>> from functools import *
>>> @lru_cache()
... def g():
...     yield 1
>>> list(g())
>>> list(g())

I am not sure that it is safe to detect awaitables and iterables in caching decorators and automatically wrap them in re-awaitable and re-iterable objects. But we can add explicit decorators and combine them with arbitrary caching decorators. For example:

def g():
    yield 1
Date User Action Args
2022-02-14 14:35:52serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, asvetlov, yselivanov, uranusjr
2022-02-14 14:35:52serhiy.storchakasetmessageid: <>
2022-02-14 14:35:52serhiy.storchakalinkissue46622 messages
2022-02-14 14:35:52serhiy.storchakacreate