Skip to content

fix(integrations): asyncio iscoroutinefunction warning#6090

Draft
cooperoptigrid wants to merge 4 commits intogetsentry:masterfrom
cooperoptigrid:fix-integration-asyncio-iscoroutine-function-warning
Draft

fix(integrations): asyncio iscoroutinefunction warning#6090
cooperoptigrid wants to merge 4 commits intogetsentry:masterfrom
cooperoptigrid:fix-integration-asyncio-iscoroutine-function-warning

Conversation

@cooperoptigrid
Copy link
Copy Markdown

@cooperoptigrid cooperoptigrid commented Apr 17, 2026

Description

Uses Django ASGI function patching to use inspect.iscoroutinefunction instead of asyncio.iscoroutinefunction to avoid depreaction warning in 3.14.
Rolled out to all uses of asyncio.iscoroutinefunction in the integrations package.

Repro in issue doesn't raise warning with these changes. tox linters and test pass on py3.12, py3.14.

Issues

Reminders

@sdk-maintainer-bot sdk-maintainer-bot bot added issue-already-assigned Used for automated community contribution checks. violating-contribution-guidelines Used for automated community contribution checks. labels Apr 17, 2026
@sdk-maintainer-bot
Copy link
Copy Markdown

This PR has been automatically closed. The referenced issue is already assigned to someone else.

If you believe this assignment is outdated, please comment on the issue to discuss before opening a new PR.

Please review our contributing guidelines for more details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 17, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (ci) Cancel in-progress PR workflows on new commit push by joshuarli in #5994
  • Add db.driver.name spans to database integrations by ericapisani in #6082

Bug Fixes 🐛

  • (google_genai) Redact binary data in inline_data and fix multi-part message extraction by ericapisani in #5977
  • (grpc) Add isolation_scope to async server interceptor by robinvd in #5940
  • (integrations) Asyncio iscoroutinefunction warning by cooperoptigrid in #6090
  • (profiler) Stop nulling buffer on teardown by ericapisani in #6075

Internal Changes 🔧

  • (celery) Remove unused NoOpMgr from utils by sentrivana in #6078
  • (ci) Update outdated pinned action version comments by JoshuaMoelans in #6088
  • (pydantic-ai) Remove dead Model.request patch by alexander-alderman-webb in #5956
  • (tests) Replace deprecated enable_tracingwith traces_sample_rate by sentrivana in #6077
  • Set explicit base-branch for codecov action by ericapisani in #5992

🤖 This preview updates automatically when you update the PR.

@ericapisani ericapisani reopened this Apr 20, 2026
@ericapisani ericapisani removed violating-contribution-guidelines Used for automated community contribution checks. issue-already-assigned Used for automated community contribution checks. labels Apr 20, 2026
Copy link
Copy Markdown
Contributor

@alexander-alderman-webb alexander-alderman-webb left a comment

Choose a reason for hiding this comment

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

inspect.iscoroutinefunction is not a drop-in replacement for asyncio.iscoroutinefunction on old Python versions (which we support).

There's some details in this blog post: https://lucumr.pocoo.org/2016/10/30/i-dont-understand-asyncio/

There's an existing PR containing some advice on approaching the migration. Generally mirroring the respective library's version checks would be great (not just copying Django's specific handling across the whole SDK)!

#4915

Comment thread sentry_sdk/integrations/_asgi_common.py Outdated
Comment on lines +34 to +36
def _markcoroutinefunction(func: "_F") -> "_F":
func._is_coroutine = asyncio.coroutines._is_coroutine # type: ignore[attr-defined]
return func
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

_markcoroutinefunction is not used outside of the Django integration, so please leave it there.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've simply moved it back for this PR. Still digesting the other comment

@cooperoptigrid cooperoptigrid force-pushed the fix-integration-asyncio-iscoroutine-function-warning branch 2 times, most recently from b90710a to 6d83d5e Compare April 20, 2026 23:32
@cooperoptigrid cooperoptigrid force-pushed the fix-integration-asyncio-iscoroutine-function-warning branch from 6d83d5e to 6da51e6 Compare April 20, 2026 23:33
@cooperoptigrid
Copy link
Copy Markdown
Author

#4915

@alexander-alderman-webb Do you want me to take those changes from that PR and add those patches here and address any outstanding comments? Or were there fundamental issues blocking its merge, and I should take a different approach entirely.

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.

asyncio.iscoroutinefunction usage in integrations raises deprecation warning on 3.14

3 participants