Message 348434 - Python tracker

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.

Content
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.