Andrew Svetlov <andrew.svet...@gmail.com> added the comment:

I still think that iscoroutinefunction should not be used for async/sync 
decoration type autodetection.

A day ago stuck with a case when decorator used iscoroutinefunction() for 
separation but returned a regular function wrapper that returns awaitable in 
turn.

As a result, the transparent decorator which should not modify a decorated 
function signature cannot be applied twice, e.g.

@retry
@retry
async def fetch(): 
    ...

This is very confusing behavior, the obvious fix is providing `sync_retry` and 
`async_retry` decorators to never mix the behavior.

Seems very close to the problem discussed here.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37398>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to