sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

fix: Replace asyncio.iscoroutinefunction with compatibility shim for Python 3.16

Open Dibbu-cell opened this issue 3 months ago • 7 comments

Description

This PR fixes the deprecation warning for asyncio.iscoroutinefunction that will be removed in Python 3.16. The function was deprecated in Python 3.12 in favor of inspect.iscoroutinefunction.

Issues

  • resolves: #4900

Reminders

Dibbu-cell avatar Oct 10 '25 18:10 Dibbu-cell

ok, i will do that.

Dibbu-cell avatar Oct 13 '25 11:10 Dibbu-cell

I have done the appropriate changes.

Dibbu-cell avatar Oct 15 '25 12:10 Dibbu-cell

It looks like some unrelated changes snuck in with your most recent commit @Dibbu-cell. Can you please revert everything unrelated to changing iscoroutinefunction? There are many ways to do this but here's a one-liner you can use on the terminal:

git checkout master -- sentry_sdk/integrations/django/asgi.py sentry_sdk/client.py tests/tracing/test_allow_n_plus_one.py

Also please revert sentry_sdk/integrations/django/asgi.py since I don't see any reason to change the detection of coroutine functions in the Django integration.

Thanks!

alexander-alderman-webb avatar Oct 15 '25 13:10 alexander-alderman-webb

I have done the changes and sorry for troubling you.

Dibbu-cell avatar Oct 15 '25 13:10 Dibbu-cell

I am new in open Source .

Dibbu-cell avatar Oct 15 '25 13:10 Dibbu-cell

check if there is problem let me know.

Dibbu-cell avatar Oct 15 '25 13:10 Dibbu-cell

Hi @Dibbu-cell,

Don't worry, we're open to accept contributions!

It looks like you've reverted too many of your changes. I can only see a change on sentry_sdk/_compat.py now.

Since the issue you've tackled affects many integrations and you're new to open source I suggest we narrow the scope. Changes to the integrations also have more edge cases to consider so are more complicated than I initially anticipated.

Could you only change tests/integrations/httpx/test_httpx.py by replacing asyncio.iscoroutinefunction with inspect.iscoroutinefunction, and leave everything else unchanged.

alexander-alderman-webb avatar Oct 16 '25 12:10 alexander-alderman-webb