[issue37398] contextlib.ContextDecorator decorating async functions

Andrew Svetlov report at bugs.python.org
Tue Jun 25 08:17:15 EDT 2019


Andrew Svetlov <andrew.svetlov at gmail.com> added the comment:

Got you.

iscoroutinefunction() is not reliable: it detects async functions only but fails if we have a regular function that returns awaitable object.

I think AsyncContextDecorator is needed here to explicitly point that you want to wrap async function.

Another question is: sync or async context manager should be applied? I see use cases for both variants

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37398>
_______________________________________


More information about the Python-bugs-list mailing list