Skip to content

DeprecationWarning: asyncio.iscoroutinefunction #263

@dmytrotus

Description

@dmytrotus

DeprecationWarning: asyncio.iscoroutinefunction deprecated in Python 3.14+

Description

When using slowapi with Python 3.14, the following deprecation warning is raised:

/usr/local/lib/python3.14/site-packages/slowapi/extension.py:717: DeprecationWarning:
'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16;
use inspect.iscoroutinefunction() instead

Environment

  • Python version: 3.14
  • slowapi version: 0.1.9
  • FastAPI version: 0.135.1

Expected behavior

inspect.iscoroutinefunction() should be used instead of asyncio.iscoroutinefunction() as recommended by the Python docs.

Suggested fix

In extension.py line 717, replace:

if asyncio.iscoroutinefunction(func):

with:

if inspect.iscoroutinefunction(func):

This is a one-line fix. Could you let me know if there is a planned release that will address this? Happy to open a PR if that would help!

Thank you for maintaining this library 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions