Skip to content

Conversation

@bellini666
Copy link
Contributor

Upgrading a Django ASGI application to Python 3.12 broke because of the integration not being able to identify that the middleware being called was async.

This is due to Python 3.12 replacing setting _is_coroutine = asyncio.coroutines._is_coroutine with inspect.markcoroutinefunction

This ports the fix from asgiref to make sure sentry_sdk can support multiple python versions.

I thought about importing it from asgiref, but not sure how the maintainers feel about requiring it as a dependency (although it is already a django's dependency)

@sentrivana
Copy link
Contributor

Hey @bellini666, thanks a lot for the fix! Taking a look.

Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

LGTM. I also think porting the asgiref shim is a good way to go about this, even if asgiref is a Django dependency.

Thanks again for the fix, will merge this now.

@sentrivana sentrivana enabled auto-merge (squash) April 30, 2024 12:01
@sentrivana sentrivana merged commit fb1b746 into getsentry:master Apr 30, 2024
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