fix: Replace asyncio.iscoroutinefunction with compatibility shim for Python 3.16
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
- Please add tests to validate your changes, and lint your code using
tox -e linters. - Add GH Issue ID & Linear ID (if applicable)
- PR title should use conventional commit style (
feat:,fix:,ref:,meta:) - For external contributors: CONTRIBUTING.md, Sentry SDK development docs, Discord community
ok, i will do that.
I have done the appropriate changes.
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!
I have done the changes and sorry for troubling you.
I am new in open Source .
check if there is problem let me know.
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.