fix(integrations): asyncio iscoroutinefunction warning#6090
fix(integrations): asyncio iscoroutinefunction warning#6090cooperoptigrid wants to merge 4 commits intogetsentry:masterfrom
Conversation
|
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. |
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
alexander-alderman-webb
left a comment
There was a problem hiding this comment.
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)!
| def _markcoroutinefunction(func: "_F") -> "_F": | ||
| func._is_coroutine = asyncio.coroutines._is_coroutine # type: ignore[attr-defined] | ||
| return func |
There was a problem hiding this comment.
_markcoroutinefunction is not used outside of the Django integration, so please leave it there.
There was a problem hiding this comment.
I've simply moved it back for this PR. Still digesting the other comment
b90710a to
6d83d5e
Compare
6d83d5e to
6da51e6
Compare
|
@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. |
Description
Uses Django ASGI function patching to use
inspect.iscoroutinefunctioninstead ofasyncio.iscoroutinefunctionto avoid depreaction warning in 3.14.Rolled out to all uses of
asyncio.iscoroutinefunctionin 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
tox -e linters.feat:,fix:,ref:,meta:)