Skip to content

Fix DeprecationWarning: asyncio.iscoroutinefunction on Python 3.14#1075

Open
MertYksl03 wants to merge 1 commit intocanbula:masterfrom
MertYksl03:fix/asyncio-deprecation
Open

Fix DeprecationWarning: asyncio.iscoroutinefunction on Python 3.14#1075
MertYksl03 wants to merge 1 commit intocanbula:masterfrom
MertYksl03:fix/asyncio-deprecation

Conversation

@MertYksl03
Copy link
Copy Markdown
Contributor

Describe the changes

While running the tests locally on Python 3.14, I noticed a DeprecationWarning regarding asyncio.iscoroutinefunction. Since this is slated for removal in 3.16, I’ve updated the test_awaitable method to use inspect.iscoroutinefunction to ensure future compatibility. We use Python 3.12 i know but this is a good practice to avoid deprecation warnings and ensure the code remains functional in future Python versions.

Warning Message

  /home/mert/School/parallel-programming/Week05/test_awaitme.py:26: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead
    assert asyncio.iscoroutinefunction(dummy_awaitable), "awaitme is not awaitable in " + f[:-3]
Week05/test_awaitme.py::test_awaitable
  /home/mert/School/parallel-programming/Week05/test_awaitme.py:27: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead
    assert asyncio.iscoroutinefunction(dummy_function), "awaitme is not awaitable in " + f[:-3]

Expected Behavior

No deprecation warnings. asyncio.iscoroutinefunction should be replaced with inspect.iscoroutinefunction.
inspect.iscoroutinefunction is available since Python 3.5, so this is fully backward-compatible.

Does this look okay to merge?

Checklist

  • I have read the [CONTRIBUTING]
  • I have performed a self-review of my own code
  • I have run the code locally and it works as expected

Copy link
Copy Markdown
Owner

@canbula canbula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much Mert ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants